标签: alpine-linux

使用 gitlab-ci 时 alpine 无法访问 docker 守护进程

我有一个自定义的 gitlab ci,我想编译一个 Golang 应用程序并构建一个 docker 镜像。我决定为 gitlab 运行程序使用 alpine docker 镜像。我无法启动 docker。我尝试手动启动 docker 并收到错误 ( * WARNING: docker is already starting),如果我不手动启动 docker 服务,我会收到 ( Fails (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?) 其他人也遇到过这种情况吗?

这不会是一个重复的问题。Gitlab 运行程序在 root 中运行 docker alpine 容器(通过运行 whoami 进行验证)。为了尝试,我确实尝试了usermod -aG docker $(whoami)并得到了相同的输出。

.gitlab-ci.yml

image: alpine

variables:
  GO_PROJECT: linkscout

before_script:
  - apk add --update go git libc-dev docker openrc
  - mkdir -p ~/go/src/${GO_PROJECT}
  - cp -r ${CI_PROJECT_DIR}/* …
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci gitlab-ci-runner alpine-linux

7
推荐指数
1
解决办法
6853
查看次数

如何在 Alpine Docker 镜像上安装 pyarrow?

我正在尝试在我的 alpine docker 映像中使用 pip 安装 pyarrow,但 pip 无法找到该包。

我正在使用以下 Dockerfile:

FROM python:3.6-alpine3.7

RUN apk add --no-cache musl-dev linux-headers g++

RUN pip install pyarrow
Run Code Online (Sandbox Code Playgroud)

输出:

Sending build context to Docker daemon  4.096kB
Step 1/3 : FROM python:3.6-alpine3.7
3.6-alpine3.7: Pulling from library/python
ff3a5c916c92: Pull complete
471170bb1257: Pull complete
d487cc70216e: Pull complete
9358b3ca3321: Pull complete
78b9945f52f1: Pull complete
Digest: 
sha256:10bd7a59cfac2a784bedd1e6d89887995559f00b61f005a101845ed736bed779
Status: Downloaded newer image for python:3.6-alpine3.7
---> 4b00a94b6f26
Step 2/3 : RUN apk add --no-cache musl-dev linux-headers g++
---> Running in d024d0b961a6 …
Run Code Online (Sandbox Code Playgroud)

python docker alpine-linux pyarrow

7
推荐指数
2
解决办法
1万
查看次数

Alpine 容器内的 docker-compose

我正在尝试将我的应用程序(代码、Dockerfiles 和 docker-compose 脚本)捆绑在一个映像内,以便于部署(入口点将只是docker-compose up)。我的这个顶级应用程序映像的 Dockerfile 看起来像这样

FROM alpine:latest
COPY . /app
RUN apk update && apk add --no-cache docker py-pip openrc && pip install docker-compose
Run Code Online (Sandbox Code Playgroud)

当我运行这个镜像时,dockerd 似乎还没有启动,没有出现在top结果中;docker ps报告“无法连接到位于 unix:///var/run/docker.sock 的 Docker 守护进程。docker 守护进程正在运行吗?”。但是,如果我这样做service docker start,则会返回“*警告:docker 已经启动”。为了让 Docker 在 Alpine 容器中工作,我需要做些什么特别的事情吗?

docker docker-compose alpine-linux

7
推荐指数
1
解决办法
2万
查看次数

启动容器进程导致“exec:\”/ app \“:权限被拒绝”:未知

当我尝试使用 docker 构建 golang 时

docker的镜像构建成功,但是使用docker run运行时出现如下错误

docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/app\": permission denied": unknown.
Run Code Online (Sandbox Code Playgroud)

我认为这个错误导致没有添加用户,所以我添加了组和用户,如下所示

RUN groupadd -g 10001 myapp \
    && useradd -u 10001 -g myapp myapp
Run Code Online (Sandbox Code Playgroud)

但没有修复。

这是我的源 docker 文件

FROM golang:1.12.9 as builder

ADD . /go/src/appname/

WORKDIR /go/src/appname/

ENV GO111MODULE=on

COPY go.mod .
COPY go.sum .

RUN go mod download
COPY . .

RUN  CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build target=prod

FROM alpine

RUN apk update …
Run Code Online (Sandbox Code Playgroud)

go docker alpine-linux

7
推荐指数
1
解决办法
1万
查看次数

尝试访问本地 API 端点时,React/Next.js docker 构建失败

我似乎无法获取我的node:alpine Docker 镜像来构建react/next.js。

我可以让它在本地正常构建,但当 Docker 构建到达 API 端点时,我从未在 API 日志中看到流量,该端点本身在 Docker 容器(nginx、headless craft cms 等)中运行。

正如我所尝试的那样,构建似乎根本不喜欢本地主机:

http://localhost:9000/api

...这是我在日志中收到的消息:

#15 13.76 > Build error occurred
#15 13.76 FetchError: request to http://localhost:9000/api failed, reason: connect ECONNREFUSED 127.0.0.1:9000
Run Code Online (Sandbox Code Playgroud)

我听说我可以使用主机名代替“localhost”,因此在我的 MacOS 终端中,我输入了“主机名”,并将 localhost 替换为该值。这不会完全出错,但构建会挂在构建的“生成页面...”步骤上。

如何让 Docker 构建识别本地主机,或者换句话说,如何将 API URL 设置为本地 Docker 容器托管的端点?

这是我的 Dockerfile:

# Install dependencies only when needed
FROM node:alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn --frozen-lockfile

# Rebuild the source code only …
Run Code Online (Sandbox Code Playgroud)

node.js docker reactjs alpine-linux next.js

7
推荐指数
2
解决办法
6353
查看次数

Docker 镜像可以在 Intel mac 上运行,但不能在 M1 mac 上运行

我们有一个在 Docker 容器中运行的 Java Spring Boot 应用程序。它基于 openjdk:13-jdk-alpine。我们将其部署到 Linux 计算机上,但我们也可以在 Windows 计算机以及基于 Intel 的 iMac 上本地运行它。

但我们发现它无法在基于 ARM 的 MacBook Pro 上正常运行。我们得到的异常是基本的 Java 错误,例如“找不到符号 Java.class[]”,以及其他看起来 JVM 已关闭的错误。

有没有办法构建一个适用于所有这些平台(包括 M1 MacBook Pro)的 Docker 映像?

java jvm docker alpine-linux apple-m1

7
推荐指数
2
解决办法
2万
查看次数

在 docker 镜像 python:3.9.13-alpine3.16 上使用“pip install psutil”错误:找不到 linux/ethtool.h

我尝试在 docker 中安装 python 模块 psutil python:3.9.13-alpine3.16
\n但它报告以下错误:

\n
Building wheels for collected packages: psutil\n  Building wheel for psutil (pyproject.toml) ... error\n  error: subprocess-exited-with-error\n  \n  \xc3\x97 Building wheel for psutil (pyproject.toml) did not run successfully.\n  \xe2\x94\x82 exit code: 1\n  \xe2\x95\xb0\xe2\x94\x80> [51 lines of output]\n      /tmp/tmpb62wij4i.c:1:10: fatal error: linux/ethtool.h: No such file or directory\n          1 | #include <linux/ethtool.h>\n            |          ^~~~~~~~~~~~~~~~~\n      compilation terminated.\n      running bdist_wheel\n      running build\n      running build_py\n      creating build\n      creating build/lib.linux-x86_64-cpython-39\n      creating build/lib.linux-x86_64-cpython-39/psutil\n      copying psutil/__init__.py -> build/lib.linux-x86_64-cpython-39/psutil\n      copying psutil/_common.py -> …
Run Code Online (Sandbox Code Playgroud)

python makefile psutil alpine-linux

7
推荐指数
1
解决办法
5918
查看次数

错误:http://dl-4.alpinelinux.org/alpine/edge/testing:不受信任的签名

我对此很陌生,但我继承了一个项目,其中运行时构建是使用 dockerfile 和如下命令创建的:

# Build runtime image

FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine

RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories;

RUN apk update && apk add libgdiplus

RUN apk add --no-cache icu-libs
Run Code Online (Sandbox Code Playgroud)

gitlab 管道显示了这一点:

Step 15/20 : RUN apk update && apk add libgdiplus

96 ---> Running in 95f8ebccb602

97fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz

98fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz

99fetch http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz

100ERROR: http://dl-4.alpinelinux.org/alpine/edge/testing: UNTRUSTED signature

101WARNING: Ignoring APKINDEX.24c95890.tar.gz: No such file or directory

102v3.10.9-43-g3feb769ea3 [http://dl-cdn.alpinelinux.org/alpine/v3.10/main]

103v3.10.6-10-ged79a86de3 [http://dl-cdn.alpinelinux.org/alpine/v3.10/community]

1041 errors; 10355 distinct packages available

105Service 'api' failed to build: The command '/bin/sh -c …
Run Code Online (Sandbox Code Playgroud)

pipeline gitlab docker alpine-linux

7
推荐指数
2
解决办法
1万
查看次数

是否可以在 postgres:15.3-alpine 图像之上添加 pgvector 扩展

我正在尝试对 pg-vector 进行 dockerize,我从官方存储库中找到了这个 Dockerfile。 https://github.com/pgvector/pgvector/blob/master/Dockerfile#L2C1-L3C1

Dockerfile 目前使用 postgres 基础映像,我想知道是否可以在 alpine 映像之上添加 pgvector 扩展。如果没有,还有哪些其他可能的选择?

postgresql docker dockerfile alpine-linux pgvector

7
推荐指数
1
解决办法
2867
查看次数

在 PHP 8.2 和最新的 Alpine Linux 3.19 上使用 IntlDateFormatter 格式化日期时缺少阿拉伯数字

我正在尝试将我的 PHP 项目从 PHP 7.4 更新到 8.2。IntlDateFormatter我在使用类格式化日期时遇到问题ar_AE我在 PHP 8.2 Alpine 3.19 版本下使用区域在我之前的设置(PHP 7.4 Alpine 3.12)中,格式化日期返回整个阿拉伯字符字符串,但在 8.2 下,这种情况不会发生,在输出中我有阿拉伯字母,而不是数字。

\n

在工作期间,我发现 ICU 数据已在 Linux Alpine 3.16 中拆分( https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.16.0#ICU_data_spliticu-libs ),因此我已将和添加icu-data-full到 8.2 Dockerfile 中。这部分解决了我的问题,因为数字仍然没有显示在ar_AE区域设置中显示。

\n

PHP 7.4 的输出:

\n
/var/www $ php test.php\nar_AE: \xd8\xa7\xd9\x84\xd8\xb3\xd8\xa8\xd8\xaa\xd8\x8c \xd9\xa1 \xd9\x8a\xd9\x86\xd8\xa7\xd9\x8a\xd8\xb1 \xd9\xa2\xd9\xa0\xd9\xa2\xd9\xa2 \xd9\xa1\xd9\xa2:\xd9\xa5\xd9\xa9:\xd9\xa5\xd9\xa9 \xd8\xb5 \xd8\xaa\xd9\x88\xd9\x82\xd9\x8a\xd8\xaa \xd9\x88\xd8\xb3\xd8\xb7 \xd8\xa3\xd9\x88\xd8\xb1\xd9\x88\xd8\xa8\xd8\xa7 \xd8\xa7\xd9\x84\xd8\xb1\xd8\xb3\xd9\x85\xd9\x8a\nar_QA: \xd8\xa7\xd9\x84\xd8\xb3\xd8\xa8\xd8\xaa\xd8\x8c \xd9\xa1 \xd9\x8a\xd9\x86\xd8\xa7\xd9\x8a\xd8\xb1 \xd9\xa2\xd9\xa0\xd9\xa2\xd9\xa2 \xd9\xa1\xd9\xa2:\xd9\xa5\xd9\xa9:\xd9\xa5\xd9\xa9 \xd8\xb5 \xd8\xaa\xd9\x88\xd9\x82\xd9\x8a\xd8\xaa \xd9\x88\xd8\xb3\xd8\xb7 \xd8\xa3\xd9\x88\xd8\xb1\xd9\x88\xd8\xa8\xd8\xa7 \xd8\xa7\xd9\x84\xd8\xb1\xd8\xb3\xd9\x85\xd9\x8a\nar_SA: \xd8\xa7\xd9\x84\xd8\xb3\xd8\xa8\xd8\xaa\xd8\x8c \xd9\xa1 \xd9\x8a\xd9\x86\xd8\xa7\xd9\x8a\xd8\xb1 \xd9\xa2\xd9\xa0\xd9\xa2\xd9\xa2 \xd9\x85 \xd9\xa1\xd9\xa2:\xd9\xa5\xd9\xa9:\xd9\xa5\xd9\xa9 \xd8\xb5 \xd8\xaa\xd9\x88\xd9\x82\xd9\x8a\xd8\xaa \xd9\x88\xd8\xb3\xd8\xb7 \xd8\xa3\xd9\x88\xd8\xb1\xd9\x88\xd8\xa8\xd8\xa7 \xd8\xa7\xd9\x84\xd8\xb1\xd8\xb3\xd9\x85\xd9\x8a\n
Run Code Online (Sandbox Code Playgroud)\n …

php arabic icu intl alpine-linux

7
推荐指数
1
解决办法
133
查看次数