Docker: 随机的 Alpine 包安装失败
Docker: random Alpine packages fail to install
上下文
我有一个 jenkins 可以为 raspberry pi 2 构建一个 docker 图像。
它在构建期间使用 buildx 来模拟 ArmV7 环境。
这一直很好用,直到最近我在安装 apk 包时遇到了随机错误。
Dockerfile
FROM python:3-alpine
# picam python module
ARG PICAMERA_RELEASE_ADDRESS="{private_repo}"
# Ardafruit python module
ARG ARDAFRUIT_RELEASE_URL="{private_repo}"
WORKDIR /tmp
ENV LD_LIBRARY_PATH="/opt/vc/lib"
COPY ./files /app
RUN apk add --no-cache --verbose \
raspberrypi-libs \
bluez \
bluez-deprecated \
unzip \
git \
glib-dev \
gobject-introspection-dev \
cairo-dev \
py3-cairo \
openssl-dev \
nano \
bash \
alpine-sdk \
&& git clone ${PICAMERA_RELEASE_ADDRESS} \
&& cd picamera \
&& su -c "python3 setup.py install" \
&& cd /tmp/ \
&& git clone ${ARDAFRUIT_RELEASE_URL} \
&& cd Adafruit_Python_DHT \
&& su -c "python3 setup.py install --force-pi2" \
&& cd /tmp/ \
&& CFLAGS="-fcommon" pip3 install \
btlewrap==0.0.* \
Flask==2.* \
waitress==2.* \
flask-cors==3.* \
miflora==0.* \
colorzero==2.* \
RPi.GPIO==0.7.* \
&& cd /tmp/ \
&& chmod +x /app/main.py \
&& chmod +x /app/healthcheck.py \
&& chmod +x /app/harden.sh \
&& apk del \
unzip \
git \
glib-dev \
gobject-introspection-dev \
cairo-dev \
py3-cairo \
openssl-dev \
nano \
bash \
alpine-sdk \
libc-utils \
&& rm -rf /tmp/* \
&& sh /app/harden.sh \
&& rm -f /app/harden.sh \
&& rm -f /bin/rm
# finalize
WORKDIR /app
EXPOSE 80
ENTRYPOINT [ "python3" ]
CMD [ "/app/main.py" ]
HEALTHCHECK --interval=1m --timeout=10s \
CMD python3 /app/healthcheck.py
构建管道
pipeline {
environment {
registryCredential = ''
registryURL = ''
scmURL = ''
scmCredential = ''
dockerImage = ''
working_branch = ''
working_dir = ''
}
agent any
stages {
stage('Cloning Git') {
steps {
git(
url: scmURL,
credentialsId: scmCredential,
branch: working_branch
)
}
}
stage('docker login') {
steps {
sh '$(aws ecr get-login --no-include-email --region eu-central-1)'
}
}
stage('Build Image and push it') {
steps{
dir(working_dir){
sh "docker build -t $registryURL:latest --platform linux/arm/v7 --push ."
}
}
}
}
}
詹金斯输出
#7 [3/5] COPY ./files /app
#7 DONE 0.0s
#8 [4/5] RUN apk fix && apk add --no-cache --verbose raspberrypi-libs bluez bluez-deprecated unzip git glib-dev gobject-introspection-dev cairo-dev py3-cairo openssl-dev nano bash alpine-sdk && apk fix && git clone https://{private_repo} && cd picamera && su -c "python3 setup.py install" && cd /tmp/ && git clone https://{private_repo} && cd Adafruit_Python_DHT && su -c "python3 setup.py install --force-pi2" && cd /tmp/ && CFLAGS="-fcommon" pip3 install btlewrap==0.0.* Flask==2.* waitress==2.* flask-cors==3.* miflora==0.* colorzero==2.* RPi.GPIO==0.7.* && cd /tmp/ && chmod +x /app/main.py && chmod +x /app/healthcheck.py && chmod +x /app/harden.sh && apk del unzip git glib-dev gobject-introspection-dev cairo-dev py3-cairo openssl-dev nano bash alpine-sdk libc-utils && rm -rf /tmp/* && sh /app/harden.sh && rm -f /app/harden.sh && rm -f /bin/rm
#8 0.337 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz
#8 1.611 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz
#8 3.302 OK: 11 MiB in 37 packages
#8 3.581 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz
#8 4.617 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz
#8 6.349 (1/130) Installing fakeroot (1.25.3-r3)
#8 6.382 (2/130) Installing openssl (1.1.1l-r0)
#8 6.465 (3/130) Installing libattr (2.5.1-r0)
#8 6.487 (4/130) Installing attr (2.5.1-r0)
#8 6.517 (5/130) Installing libacl (2.2.53-r0)
#8 6.540 (6/130) Installing tar (1.34-r0)
#8 6.632 (7/130) Installing pkgconf (1.7.4-r0)
#8 6.667 (8/130) Installing patch (2.7.6-r7)
#8 6.715 (9/130) Installing libstdc++ (10.3.1_git20210424-r2)
#8 6.894 (10/130) Installing lzip (1.22-r0)
#8 6.929 (11/130) Installing brotli-libs (1.0.9-r5)
#8 7.062 (12/130) Installing nghttp2-libs (1.43.0-r0)
#8 7.101 (13/130) Installing libcurl (7.79.1-r0)
#8 7.185 (14/130) Installing curl (7.79.1-r0)
#8 7.244 (15/130) Installing abuild (3.8.0_rc4-r0)
#8 7.285 Executing abuild-3.8.0_rc4-r0.pre-install
#8 7.296 ERROR: abuild-3.8.0_rc4-r0.pre-install: script exited with error 1
#8 7.321 (16/130) Installing binutils (2.35.2-r2)
#8 7.910 (17/130) Installing libmagic (5.40-r1)
#8 8.140 (18/130) Installing file (5.40-r1)
#8 8.162 (19/130) Installing libgomp (10.3.1_git20210424-r2)
#8 8.226 (20/130) Installing libatomic (10.3.1_git20210424-r2)
#8 8.249 (21/130) Installing libgphobos (10.3.1_git20210424-r2)
#8 8.735 (22/130) Installing gmp (6.2.1-r0)
#8 8.805 (23/130) Installing isl22 (0.22-r0)
#8 8.991 (24/130) Installing mpfr4 (4.1.0-r0)
#8 9.056 (25/130) Installing mpc1 (1.2.1-r0)
#8 9.093 (26/130) Installing gcc (10.3.1_git20210424-r2)
#8 13.99 (27/130) Installing musl-dev (1.2.2-r3)
#8 14.57 (28/130) Installing libc-dev (0.7.2-r3)
#8 14.59 (29/130) Installing g++ (10.3.1_git20210424-r2)
#8 18.44 (30/130) Installing make (4.3-r0)
#8 18.48 (31/130) Installing fortify-headers (1.1-r1)
#8 18.50 (32/130) Installing build-base (0.5-r2)
#8 18.51 (33/130) Installing pcre2 (10.36-r0)
#8 18.58 (34/130) Installing git (2.32.0-r0)
#8 19.63 (35/130) Installing alpine-sdk (1.0-r1)
#8 19.65 (36/130) Installing bash (5.1.4-r0)
#8 19.80 Executing bash-5.1.4-r0.post-install
#8 19.82 ERROR: bash-5.1.4-r0.post-install: script exited with error 1
#8 19.82 (37/130) Installing dbus-libs (1.12.20-r2)
#8 19.88 (38/130) Installing dbus (1.12.20-r2)
#8 19.93 Executing dbus-1.12.20-r2.pre-install
#8 19.94 ERROR: dbus-1.12.20-r2.pre-install: script exited with error 1
#8 19.96 Executing dbus-1.12.20-r2.post-install
#8 19.97 ERROR: dbus-1.12.20-r2.post-install: script exited with error 1
#8 19.97 (39/130) Installing libblkid (2.37.2-r0)
#8 20.04 (40/130) Installing libmount (2.37.2-r0)
#8 20.09 (41/130) Installing pcre (8.44-r0)
#8 20.15 (42/130) Installing glib (2.68.3-r0)
#8 20.46 (43/130) Installing json-c (0.15-r1)
#8 20.52 (44/130) Installing eudev-libs (3.2.10-r0)
#8 20.59 (45/130) Installing bluez (5.58-r2)
#8 20.91 (46/130) Installing bluez-deprecated (5.58-r2)
#8 21.06 (47/130) Installing libxau (1.0.9-r0)
#8 21.08 (48/130) Installing libmd (1.0.3-r0)
#8 21.11 (49/130) Installing libbsd (0.11.3-r0)
#8 21.14 (50/130) Installing libxdmcp (1.1.3-r0)
#8 21.16 (51/130) Installing libxcb (1.14-r2)
#8 21.27 (52/130) Installing libx11 (1.7.2-r0)
#8 21.57 (53/130) Installing libxrender (0.9.10-r3)
#8 21.59 (54/130) Installing libxext (1.3.4-r0)
#8 21.61 (55/130) Installing libpng (1.6.37-r1)
#8 21.65 (56/130) Installing freetype (2.10.4-r1)
#8 21.76 (57/130) Installing fontconfig (2.13.1-r4)
#8 21.86 (58/130) Installing pixman (0.40.0-r2)
#8 21.94 (59/130) Installing cairo (1.16.0-r3)
#8 22.10 (60/130) Installing cairo-tools (1.16.0-r3)
#8 22.20 (61/130) Installing expat-dev (2.4.1-r0)
#8 22.23 (62/130) Installing brotli-dev (1.0.9-r5)
#8 22.26 (63/130) Installing zlib-dev (1.2.11-r3)
#8 22.30 (64/130) Installing libpng-dev (1.6.37-r1)
#8 22.34 (65/130) Installing freetype-dev (2.10.4-r1)
#8 22.46 (66/130) Installing blkid (2.37.2-r0)
#8 22.50 (67/130) Installing libcap-ng (0.8.2-r0)
#8 22.52 (68/130) Installing setpriv (2.37.2-r0)
#8 22.55 (69/130) Installing libsmartcols (2.37.2-r0)
#8 22.60 (70/130) Installing findmnt (2.37.2-r0)
#8 22.64 (71/130) Installing mcookie (2.37.2-r0)
#8 22.67 (72/130) Installing hexdump (2.37.2-r0)
#8 22.70 (73/130) Installing lsblk (2.37.2-r0)
#8 22.75 (74/130) Installing libfdisk (2.37.2-r0)
#8 22.84 (75/130) Installing sfdisk (2.37.2-r0)
#8 22.87 (76/130) Installing cfdisk (2.37.2-r0)
#8 22.91 (77/130) Installing partx (2.37.2-r0)
#8 22.95 (78/130) Installing flock (2.37.2-r0)
#8 22.97 (79/130) Installing logger (2.37.2-r0)
#8 23.00 (80/130) Installing uuidgen (2.37.2-r0)
#8 23.02 (81/130) Installing libeconf (0.3.8-r1)
#8 23.04 (82/130) Installing util-linux (2.37.2-r0)
#8 23.37 (83/130) Installing util-linux-dev (2.37.2-r0)
#8 23.57 (84/130) Installing fontconfig-dev (2.13.1-r4)
#8 23.60 (85/130) Installing xorgproto (2021.4-r0)
#8 23.82 (86/130) Installing libxau-dev (1.0.9-r0)
#8 23.85 (87/130) Installing xcb-proto (1.14.1-r2)
#8 23.91 (88/130) Installing libxdmcp-dev (1.1.3-r0)
#8 23.93 (89/130) Installing libxcb-dev (1.14-r2)
#8 24.08 (90/130) Installing xtrans (1.4.0-r1)
#8 24.13 (91/130) Installing libx11-dev (1.7.2-r0)
#8 24.18 (92/130) Installing libxext-dev (1.3.4-r0)
#8 24.22 (93/130) Installing libxrender-dev (0.9.10-r3)
#8 24.25 (94/130) Installing pixman-dev (0.40.0-r2)
#8 24.27 (95/130) Installing util-macros (1.19.3-r0)
#8 24.30 (96/130) Installing xcb-util (0.4.0-r3)
#8 24.32 (97/130) Installing xcb-util-dev (0.4.0-r3)
#8 24.35 (98/130) Installing cairo-gobject (1.16.0-r3)
#8 24.38 (99/130) Installing mpdecimal (2.5.1-r1)
#8 24.42 (100/130) Installing python3 (3.9.5-r1)
#8 28.02 (101/130) Installing gettext-asprintf (0.21-r0)
#8 28.04 (102/130) Installing libunistring (0.9.10-r1)
#8 28.25 (103/130) Installing gettext-libs (0.21-r0)
#8 28.39 (104/130) Installing libxml2 (2.9.12-r1)
#8 28.57 (105/130) Installing gettext (0.21-r0)
#8 28.70 (106/130) Installing gettext-dev (0.21-r0)
#8 28.95 (107/130) Installing bzip2-dev (1.0.8-r1)
#8 28.97 (108/130) Installing libxml2-utils (2.9.12-r1)
#8 29.00 (109/130) Installing libgpg-error (1.42-r0)
#8 29.07 (110/130) Installing libgcrypt (1.9.4-r0)
#8 29.22 (111/130) Installing libxslt (1.1.34-r1)
#8 29.28 (112/130) Installing docbook-xml (4.5-r6)
#8 29.47 Executing docbook-xml-4.5-r6.post-install
#8 29.47 ERROR: docbook-xml-4.5-r6.post-install: script exited with error 1
#8 29.48 (113/130) Installing docbook-xsl (1.79.2-r2)
#8 30.38 Executing docbook-xsl-1.79.2-r2.post-install
#8 30.39 (114/130) Installing linux-headers (5.10.41-r0)
#8 30.39 ERROR: docbook-xsl-1.79.2-r2.post-install: script exited with error 1
#8 31.04 (115/130) Installing libffi-dev (3.3-r2)
#8 31.09 (116/130) Installing libpcre16 (8.44-r0)
#8 31.14 (117/130) Installing libpcre32 (8.44-r0)
#8 31.19 (118/130) Installing libpcrecpp (8.44-r0)
#8 31.22 (119/130) Installing pcre-dev (8.44-r0)
#8 31.40 (120/130) Installing glib-dev (2.68.3-r0)
#8 31.68 (121/130) Installing cairo-dev (1.16.0-r3)
#8 31.72 (122/130) Installing libltdl (2.4.6-r7)
#8 31.76 (123/130) Installing libtool (2.4.6-r7)
#8 31.99 (124/130) Installing gobject-introspection (1.68.0-r1)
#8 32.10 (125/130) Installing gobject-introspection-dev (1.68.0-r1)
#8 32.61 (126/130) Installing nano (5.7-r2)
#8 32.68 (127/130) Installing openssl-dev (1.1.1l-r0)
#8 32.84 (128/130) Installing py3-cairo (1.20.1-r0)
#8 32.87 (129/130) Installing raspberrypi-libs (0.20200813-r0)
#8 33.12 (130/130) Installing unzip (6.0-r9)
#8 33.19 Executing busybox-1.33.1-r6.trigger
#8 33.33 Executing dbus-1.12.20-r2.trigger
#8 33.48 Executing glib-2.68.3-r0.trigger
#8 33.66 No schema files found: doing nothing.
#8 33.75 5 errors; 167 packages, 603 dirs, 10399 files, 282 MiB
#8 ERROR: process "/dev/.buildkit_qemu_emulator /bin/sh -c apk fix && apk add --no-cache --verbose raspberrypi-libs \t\tbluez bluez-deprecated \t\tunzip git \t\tglib-dev \t\tgobject-introspection-dev \t\tcairo-dev \t\tpy3-cairo \t\topenssl-dev \t\tnano bash alpine-sdk && apk fix && git clone ${PICAMERA_RELEASE_ADDRESS} && cd picamera && su -c \"python3 setup.py install\" && cd /tmp/ && git clone ${ARDAFRUIT_RELEASE_URL} && cd Adafruit_Python_DHT && su -c \"python3 setup.py install --force-pi2\" && cd /tmp/ && CFLAGS=\"-fcommon\" pip3 install btlewrap==0.0.* Flask==2.* waitress==2.* flask-cors==3.* miflora==0.* colorzero==2.* RPi.GPIO==0.7.* && cd /tmp/ && chmod +x /app/main.py && chmod +x /app/healthcheck.py && chmod +x /app/harden.sh && apk del \t\tunzip git \t\tglib-dev \t\tgobject-introspection-dev \t\tcairo-dev \t\tpy3-cairo \t\topenssl-dev \t\tnano bash alpine-sdk libc-utils && rm -rf /tmp/* && sh /app/harden.sh && rm -f /app/harden.sh && rm -f /bin/rm" did not complete successfully: exit code: 5
如您所见,在安装 abuild、bash、dbus、docbook-xml 和 docbook-xsl 时出现错误,但这些错误并不一致,在 运行 之前运行 之后,abuild 和 dbus 安装成功。
只有 docbook-xsl(唯一一致的错误)
我不确定导致问题的原因,或者如何获取有关该错误的更多信息。
运行 直接在 raspberry pi 上构建当然可以,因此错误似乎位于多体系结构配置中的某处,但我不确定可能发生了什么变化。
好的,看来我在这里找到了解决方案:
https://gitlab.alpinelinux.org/alpine/aports/-/issues/12406
引自莱尔富兰克林:
I hit this error when trying to build a cross-platform ARM64 docker
image from a AMD64 host. However, running docker run --rm --privileged linuxkit/binfmt:v0.8 or update-binfmts --enable
prior to running the build seems to avoid the issue. My understanding Docker
will try to use upstream QEMU if it is installed and registered with
the kernel, otherwise Docker will fallback to using a built-in forked
version of QEMU. The build error above only showed up for me with the
forked QEMU.
所以如果我再次遇到错误,我可能会将 docker run --rm --privileged linuxkit/binfmt:v0.8 && update-binfmts --enable
添加到我的管道文件中,目前 运行 它曾经解决了这个问题。
上下文
我有一个 jenkins 可以为 raspberry pi 2 构建一个 docker 图像。 它在构建期间使用 buildx 来模拟 ArmV7 环境。 这一直很好用,直到最近我在安装 apk 包时遇到了随机错误。
Dockerfile
FROM python:3-alpine
# picam python module
ARG PICAMERA_RELEASE_ADDRESS="{private_repo}"
# Ardafruit python module
ARG ARDAFRUIT_RELEASE_URL="{private_repo}"
WORKDIR /tmp
ENV LD_LIBRARY_PATH="/opt/vc/lib"
COPY ./files /app
RUN apk add --no-cache --verbose \
raspberrypi-libs \
bluez \
bluez-deprecated \
unzip \
git \
glib-dev \
gobject-introspection-dev \
cairo-dev \
py3-cairo \
openssl-dev \
nano \
bash \
alpine-sdk \
&& git clone ${PICAMERA_RELEASE_ADDRESS} \
&& cd picamera \
&& su -c "python3 setup.py install" \
&& cd /tmp/ \
&& git clone ${ARDAFRUIT_RELEASE_URL} \
&& cd Adafruit_Python_DHT \
&& su -c "python3 setup.py install --force-pi2" \
&& cd /tmp/ \
&& CFLAGS="-fcommon" pip3 install \
btlewrap==0.0.* \
Flask==2.* \
waitress==2.* \
flask-cors==3.* \
miflora==0.* \
colorzero==2.* \
RPi.GPIO==0.7.* \
&& cd /tmp/ \
&& chmod +x /app/main.py \
&& chmod +x /app/healthcheck.py \
&& chmod +x /app/harden.sh \
&& apk del \
unzip \
git \
glib-dev \
gobject-introspection-dev \
cairo-dev \
py3-cairo \
openssl-dev \
nano \
bash \
alpine-sdk \
libc-utils \
&& rm -rf /tmp/* \
&& sh /app/harden.sh \
&& rm -f /app/harden.sh \
&& rm -f /bin/rm
# finalize
WORKDIR /app
EXPOSE 80
ENTRYPOINT [ "python3" ]
CMD [ "/app/main.py" ]
HEALTHCHECK --interval=1m --timeout=10s \
CMD python3 /app/healthcheck.py
构建管道
pipeline {
environment {
registryCredential = ''
registryURL = ''
scmURL = ''
scmCredential = ''
dockerImage = ''
working_branch = ''
working_dir = ''
}
agent any
stages {
stage('Cloning Git') {
steps {
git(
url: scmURL,
credentialsId: scmCredential,
branch: working_branch
)
}
}
stage('docker login') {
steps {
sh '$(aws ecr get-login --no-include-email --region eu-central-1)'
}
}
stage('Build Image and push it') {
steps{
dir(working_dir){
sh "docker build -t $registryURL:latest --platform linux/arm/v7 --push ."
}
}
}
}
}
詹金斯输出
#7 [3/5] COPY ./files /app
#7 DONE 0.0s
#8 [4/5] RUN apk fix && apk add --no-cache --verbose raspberrypi-libs bluez bluez-deprecated unzip git glib-dev gobject-introspection-dev cairo-dev py3-cairo openssl-dev nano bash alpine-sdk && apk fix && git clone https://{private_repo} && cd picamera && su -c "python3 setup.py install" && cd /tmp/ && git clone https://{private_repo} && cd Adafruit_Python_DHT && su -c "python3 setup.py install --force-pi2" && cd /tmp/ && CFLAGS="-fcommon" pip3 install btlewrap==0.0.* Flask==2.* waitress==2.* flask-cors==3.* miflora==0.* colorzero==2.* RPi.GPIO==0.7.* && cd /tmp/ && chmod +x /app/main.py && chmod +x /app/healthcheck.py && chmod +x /app/harden.sh && apk del unzip git glib-dev gobject-introspection-dev cairo-dev py3-cairo openssl-dev nano bash alpine-sdk libc-utils && rm -rf /tmp/* && sh /app/harden.sh && rm -f /app/harden.sh && rm -f /bin/rm
#8 0.337 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz
#8 1.611 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz
#8 3.302 OK: 11 MiB in 37 packages
#8 3.581 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz
#8 4.617 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz
#8 6.349 (1/130) Installing fakeroot (1.25.3-r3)
#8 6.382 (2/130) Installing openssl (1.1.1l-r0)
#8 6.465 (3/130) Installing libattr (2.5.1-r0)
#8 6.487 (4/130) Installing attr (2.5.1-r0)
#8 6.517 (5/130) Installing libacl (2.2.53-r0)
#8 6.540 (6/130) Installing tar (1.34-r0)
#8 6.632 (7/130) Installing pkgconf (1.7.4-r0)
#8 6.667 (8/130) Installing patch (2.7.6-r7)
#8 6.715 (9/130) Installing libstdc++ (10.3.1_git20210424-r2)
#8 6.894 (10/130) Installing lzip (1.22-r0)
#8 6.929 (11/130) Installing brotli-libs (1.0.9-r5)
#8 7.062 (12/130) Installing nghttp2-libs (1.43.0-r0)
#8 7.101 (13/130) Installing libcurl (7.79.1-r0)
#8 7.185 (14/130) Installing curl (7.79.1-r0)
#8 7.244 (15/130) Installing abuild (3.8.0_rc4-r0)
#8 7.285 Executing abuild-3.8.0_rc4-r0.pre-install
#8 7.296 ERROR: abuild-3.8.0_rc4-r0.pre-install: script exited with error 1
#8 7.321 (16/130) Installing binutils (2.35.2-r2)
#8 7.910 (17/130) Installing libmagic (5.40-r1)
#8 8.140 (18/130) Installing file (5.40-r1)
#8 8.162 (19/130) Installing libgomp (10.3.1_git20210424-r2)
#8 8.226 (20/130) Installing libatomic (10.3.1_git20210424-r2)
#8 8.249 (21/130) Installing libgphobos (10.3.1_git20210424-r2)
#8 8.735 (22/130) Installing gmp (6.2.1-r0)
#8 8.805 (23/130) Installing isl22 (0.22-r0)
#8 8.991 (24/130) Installing mpfr4 (4.1.0-r0)
#8 9.056 (25/130) Installing mpc1 (1.2.1-r0)
#8 9.093 (26/130) Installing gcc (10.3.1_git20210424-r2)
#8 13.99 (27/130) Installing musl-dev (1.2.2-r3)
#8 14.57 (28/130) Installing libc-dev (0.7.2-r3)
#8 14.59 (29/130) Installing g++ (10.3.1_git20210424-r2)
#8 18.44 (30/130) Installing make (4.3-r0)
#8 18.48 (31/130) Installing fortify-headers (1.1-r1)
#8 18.50 (32/130) Installing build-base (0.5-r2)
#8 18.51 (33/130) Installing pcre2 (10.36-r0)
#8 18.58 (34/130) Installing git (2.32.0-r0)
#8 19.63 (35/130) Installing alpine-sdk (1.0-r1)
#8 19.65 (36/130) Installing bash (5.1.4-r0)
#8 19.80 Executing bash-5.1.4-r0.post-install
#8 19.82 ERROR: bash-5.1.4-r0.post-install: script exited with error 1
#8 19.82 (37/130) Installing dbus-libs (1.12.20-r2)
#8 19.88 (38/130) Installing dbus (1.12.20-r2)
#8 19.93 Executing dbus-1.12.20-r2.pre-install
#8 19.94 ERROR: dbus-1.12.20-r2.pre-install: script exited with error 1
#8 19.96 Executing dbus-1.12.20-r2.post-install
#8 19.97 ERROR: dbus-1.12.20-r2.post-install: script exited with error 1
#8 19.97 (39/130) Installing libblkid (2.37.2-r0)
#8 20.04 (40/130) Installing libmount (2.37.2-r0)
#8 20.09 (41/130) Installing pcre (8.44-r0)
#8 20.15 (42/130) Installing glib (2.68.3-r0)
#8 20.46 (43/130) Installing json-c (0.15-r1)
#8 20.52 (44/130) Installing eudev-libs (3.2.10-r0)
#8 20.59 (45/130) Installing bluez (5.58-r2)
#8 20.91 (46/130) Installing bluez-deprecated (5.58-r2)
#8 21.06 (47/130) Installing libxau (1.0.9-r0)
#8 21.08 (48/130) Installing libmd (1.0.3-r0)
#8 21.11 (49/130) Installing libbsd (0.11.3-r0)
#8 21.14 (50/130) Installing libxdmcp (1.1.3-r0)
#8 21.16 (51/130) Installing libxcb (1.14-r2)
#8 21.27 (52/130) Installing libx11 (1.7.2-r0)
#8 21.57 (53/130) Installing libxrender (0.9.10-r3)
#8 21.59 (54/130) Installing libxext (1.3.4-r0)
#8 21.61 (55/130) Installing libpng (1.6.37-r1)
#8 21.65 (56/130) Installing freetype (2.10.4-r1)
#8 21.76 (57/130) Installing fontconfig (2.13.1-r4)
#8 21.86 (58/130) Installing pixman (0.40.0-r2)
#8 21.94 (59/130) Installing cairo (1.16.0-r3)
#8 22.10 (60/130) Installing cairo-tools (1.16.0-r3)
#8 22.20 (61/130) Installing expat-dev (2.4.1-r0)
#8 22.23 (62/130) Installing brotli-dev (1.0.9-r5)
#8 22.26 (63/130) Installing zlib-dev (1.2.11-r3)
#8 22.30 (64/130) Installing libpng-dev (1.6.37-r1)
#8 22.34 (65/130) Installing freetype-dev (2.10.4-r1)
#8 22.46 (66/130) Installing blkid (2.37.2-r0)
#8 22.50 (67/130) Installing libcap-ng (0.8.2-r0)
#8 22.52 (68/130) Installing setpriv (2.37.2-r0)
#8 22.55 (69/130) Installing libsmartcols (2.37.2-r0)
#8 22.60 (70/130) Installing findmnt (2.37.2-r0)
#8 22.64 (71/130) Installing mcookie (2.37.2-r0)
#8 22.67 (72/130) Installing hexdump (2.37.2-r0)
#8 22.70 (73/130) Installing lsblk (2.37.2-r0)
#8 22.75 (74/130) Installing libfdisk (2.37.2-r0)
#8 22.84 (75/130) Installing sfdisk (2.37.2-r0)
#8 22.87 (76/130) Installing cfdisk (2.37.2-r0)
#8 22.91 (77/130) Installing partx (2.37.2-r0)
#8 22.95 (78/130) Installing flock (2.37.2-r0)
#8 22.97 (79/130) Installing logger (2.37.2-r0)
#8 23.00 (80/130) Installing uuidgen (2.37.2-r0)
#8 23.02 (81/130) Installing libeconf (0.3.8-r1)
#8 23.04 (82/130) Installing util-linux (2.37.2-r0)
#8 23.37 (83/130) Installing util-linux-dev (2.37.2-r0)
#8 23.57 (84/130) Installing fontconfig-dev (2.13.1-r4)
#8 23.60 (85/130) Installing xorgproto (2021.4-r0)
#8 23.82 (86/130) Installing libxau-dev (1.0.9-r0)
#8 23.85 (87/130) Installing xcb-proto (1.14.1-r2)
#8 23.91 (88/130) Installing libxdmcp-dev (1.1.3-r0)
#8 23.93 (89/130) Installing libxcb-dev (1.14-r2)
#8 24.08 (90/130) Installing xtrans (1.4.0-r1)
#8 24.13 (91/130) Installing libx11-dev (1.7.2-r0)
#8 24.18 (92/130) Installing libxext-dev (1.3.4-r0)
#8 24.22 (93/130) Installing libxrender-dev (0.9.10-r3)
#8 24.25 (94/130) Installing pixman-dev (0.40.0-r2)
#8 24.27 (95/130) Installing util-macros (1.19.3-r0)
#8 24.30 (96/130) Installing xcb-util (0.4.0-r3)
#8 24.32 (97/130) Installing xcb-util-dev (0.4.0-r3)
#8 24.35 (98/130) Installing cairo-gobject (1.16.0-r3)
#8 24.38 (99/130) Installing mpdecimal (2.5.1-r1)
#8 24.42 (100/130) Installing python3 (3.9.5-r1)
#8 28.02 (101/130) Installing gettext-asprintf (0.21-r0)
#8 28.04 (102/130) Installing libunistring (0.9.10-r1)
#8 28.25 (103/130) Installing gettext-libs (0.21-r0)
#8 28.39 (104/130) Installing libxml2 (2.9.12-r1)
#8 28.57 (105/130) Installing gettext (0.21-r0)
#8 28.70 (106/130) Installing gettext-dev (0.21-r0)
#8 28.95 (107/130) Installing bzip2-dev (1.0.8-r1)
#8 28.97 (108/130) Installing libxml2-utils (2.9.12-r1)
#8 29.00 (109/130) Installing libgpg-error (1.42-r0)
#8 29.07 (110/130) Installing libgcrypt (1.9.4-r0)
#8 29.22 (111/130) Installing libxslt (1.1.34-r1)
#8 29.28 (112/130) Installing docbook-xml (4.5-r6)
#8 29.47 Executing docbook-xml-4.5-r6.post-install
#8 29.47 ERROR: docbook-xml-4.5-r6.post-install: script exited with error 1
#8 29.48 (113/130) Installing docbook-xsl (1.79.2-r2)
#8 30.38 Executing docbook-xsl-1.79.2-r2.post-install
#8 30.39 (114/130) Installing linux-headers (5.10.41-r0)
#8 30.39 ERROR: docbook-xsl-1.79.2-r2.post-install: script exited with error 1
#8 31.04 (115/130) Installing libffi-dev (3.3-r2)
#8 31.09 (116/130) Installing libpcre16 (8.44-r0)
#8 31.14 (117/130) Installing libpcre32 (8.44-r0)
#8 31.19 (118/130) Installing libpcrecpp (8.44-r0)
#8 31.22 (119/130) Installing pcre-dev (8.44-r0)
#8 31.40 (120/130) Installing glib-dev (2.68.3-r0)
#8 31.68 (121/130) Installing cairo-dev (1.16.0-r3)
#8 31.72 (122/130) Installing libltdl (2.4.6-r7)
#8 31.76 (123/130) Installing libtool (2.4.6-r7)
#8 31.99 (124/130) Installing gobject-introspection (1.68.0-r1)
#8 32.10 (125/130) Installing gobject-introspection-dev (1.68.0-r1)
#8 32.61 (126/130) Installing nano (5.7-r2)
#8 32.68 (127/130) Installing openssl-dev (1.1.1l-r0)
#8 32.84 (128/130) Installing py3-cairo (1.20.1-r0)
#8 32.87 (129/130) Installing raspberrypi-libs (0.20200813-r0)
#8 33.12 (130/130) Installing unzip (6.0-r9)
#8 33.19 Executing busybox-1.33.1-r6.trigger
#8 33.33 Executing dbus-1.12.20-r2.trigger
#8 33.48 Executing glib-2.68.3-r0.trigger
#8 33.66 No schema files found: doing nothing.
#8 33.75 5 errors; 167 packages, 603 dirs, 10399 files, 282 MiB
#8 ERROR: process "/dev/.buildkit_qemu_emulator /bin/sh -c apk fix && apk add --no-cache --verbose raspberrypi-libs \t\tbluez bluez-deprecated \t\tunzip git \t\tglib-dev \t\tgobject-introspection-dev \t\tcairo-dev \t\tpy3-cairo \t\topenssl-dev \t\tnano bash alpine-sdk && apk fix && git clone ${PICAMERA_RELEASE_ADDRESS} && cd picamera && su -c \"python3 setup.py install\" && cd /tmp/ && git clone ${ARDAFRUIT_RELEASE_URL} && cd Adafruit_Python_DHT && su -c \"python3 setup.py install --force-pi2\" && cd /tmp/ && CFLAGS=\"-fcommon\" pip3 install btlewrap==0.0.* Flask==2.* waitress==2.* flask-cors==3.* miflora==0.* colorzero==2.* RPi.GPIO==0.7.* && cd /tmp/ && chmod +x /app/main.py && chmod +x /app/healthcheck.py && chmod +x /app/harden.sh && apk del \t\tunzip git \t\tglib-dev \t\tgobject-introspection-dev \t\tcairo-dev \t\tpy3-cairo \t\topenssl-dev \t\tnano bash alpine-sdk libc-utils && rm -rf /tmp/* && sh /app/harden.sh && rm -f /app/harden.sh && rm -f /bin/rm" did not complete successfully: exit code: 5
如您所见,在安装 abuild、bash、dbus、docbook-xml 和 docbook-xsl 时出现错误,但这些错误并不一致,在 运行 之前运行 之后,abuild 和 dbus 安装成功。
只有 docbook-xsl(唯一一致的错误)我不确定导致问题的原因,或者如何获取有关该错误的更多信息。 运行 直接在 raspberry pi 上构建当然可以,因此错误似乎位于多体系结构配置中的某处,但我不确定可能发生了什么变化。
好的,看来我在这里找到了解决方案: https://gitlab.alpinelinux.org/alpine/aports/-/issues/12406
引自莱尔富兰克林:
I hit this error when trying to build a cross-platform ARM64 docker image from a AMD64 host. However, running
docker run --rm --privileged linuxkit/binfmt:v0.8 or update-binfmts --enable
prior to running the build seems to avoid the issue. My understanding Docker will try to use upstream QEMU if it is installed and registered with the kernel, otherwise Docker will fallback to using a built-in forked version of QEMU. The build error above only showed up for me with the forked QEMU.
所以如果我再次遇到错误,我可能会将 docker run --rm --privileged linuxkit/binfmt:v0.8 && update-binfmts --enable
添加到我的管道文件中,目前 运行 它曾经解决了这个问题。