Docker: random Alpine packages fail to install - docker

Context
I have a jenkins that builds a docker image for a raspberry pi 2.
It is using buildx to emulate the ArmV7 environment during build.
This worked great until recently I got random errors during installing the apk packages.
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 for the build
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 ."
}
}
}
}
}
Jenkins Output
#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
As you can see there are errors while installing abuild, bash, dbus, docbook-xml and docbook-xsl but these errors are not consistent, on the run before it were only docbook-xsl (the only consistent error) in the run after, abuild and dbus installed successfully.
I am not sure what causes the problem, or how to get more information about the error.
Running the build directly on the raspberry pi works of course, so it seems the error is located somewhere in the multi-arch configuration, but I am not sure what could have changed.

ok, looks like i found my solution here:
https://gitlab.alpinelinux.org/alpine/aports/-/issues/12406
quote from Lyle Franklin:
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.
So I will probably add docker run --rm --privileged linuxkit/binfmt:v0.8 && update-binfmts --enable to my pipeline file if I encounter the error again, for now running it once solved the issue.

Related

One of the configured repositories failed (Unknown),

Pretty new to docker; trying to get base layer setup on docker though it gives me these errors:
It's noting that the repository is failing / how do I set that repository?
I don't think it's AWS issue as I have been able to see the AWS push in cloud formation.
$./generate_base_layer.sh
Error: No such container: layer-container
[+] Building 27.7s (6/13)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 551B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/amazonlinux:2 0.9s
=> [auth] library/amazonlinux:pull token for registry-1.docker.io 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 37B 0.0s
=> [2/8] RUN yum install -y python37 && yum install -y python3-pip && yum install -y 26.7s
=> => # Loaded plugins: ovl, priorities
> [2/8] RUN yum install -y python37 && yum install -y python3-pip && yum install -y zip && yum clean all:
#6 0.369 Loaded plugins: ovl, priorities
#6 36.47
#6 36.47
#6 36.47 One of the configured repositories failed (Unknown),
#6 36.47 and yum doesn't have enough cached data to continue. At this point the only
#6 36.47 safe thing yum can do is fail. There are a few ways to work "fix" this:
#6 36.47
#6 36.47 1. Contact the upstream for the repository and get them to fix the problem.
#6 36.47
#6 36.47 2. Reconfigure the baseurl/etc. for the repository, to point to a working
#6 36.47 upstream. This is most often useful if you are using a newer
#6 36.47 distribution release than is supported by the repository (and the
#6 36.47 packages for the previous distribution release still work).
#6 36.47
#6 36.47 3. Run the command with the repository temporarily disabled
#6 36.47 yum --disablerepo=<repoid> ...
#6 36.47
#6 36.47 4. Disable the repository permanently, so yum won't use it by default. Yum
#6 36.47 will then just ignore the repository until you permanently enable it
#6 36.47 again or use --enablerepo for temporary usage:
#6 36.47
#6 36.47 yum-config-manager --disable <repoid>
#6 36.47 or
#6 36.47 subscription-manager repos --disable=<repoid>
#6 36.47
#6 36.47 5. Configure the failing repository to be skipped, if it is unavailable.
#6 36.47 Note that yum will try to contact the repo. when it runs most commands,
#6 36.47 so will have to try and fail each time (and thus. yum will be be much
#6 36.47 slower). If it is a very temporary problem though, this is often a nice
#6 36.47 compromise:
#6 36.47
#6 36.47 yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
#6 36.47
#6 36.47 Cannot find a valid baseurl for repo: amzn2-core/2/aarch64
#6 36.47 Could not retrieve mirrorlist http://amazonlinux.default.amazonaws.com/2/core/latest/aarch64/mirror.list error was
#6 36.47 12: Timeout on http://amazonlinux.default.amazonaws.com/2/core/latest/aarch64/mirror.list: (28, 'Failed to connect to amazonlinux.default.amazonaws.com port 80 after 4723 ms: Connection timed out')
------
executor failed running [/bin/sh -c yum install -y python37 && yum install -y python3-pip && yum install -y zip && yum clean all]: exit code: 1
Unable to find image 'base-layer:latest' locally
docker: Error response from daemon: pull access denied for base-layer, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
Error: No such container:path: layer-container:layer.zip
I've already logged into docker and tried it with docker build -t... ; same issue
dockerfile:
FROM amazonlinux:2
# Install Python
RUN yum install -y python37 && \
yum install -y python3-pip && \
yum install -y zip && \
yum clean all
# Set up PIP and Venv
RUN python3.7 -m pip install --upgrade pip && \
python3.7 -m pip install virtualenv
RUN python3.7 -m venv base
RUN source base/bin/activate
# Install dependencies
COPY ./requirements.txt .
RUN pip install -r requirements.txt -t ./python
# Zip it up for deployment.
RUN zip -r layer.zip ./python/
ENTRYPOINT ["/bin/bash", "-l"]
generate_base.. file:
# Generates a base layer for the Lambda functions.
# Remove the container first (if it exists).
docker rm layer-container
# Build the base layer.
docker build -t base-layer .
# Rename it to layer-container.
docker run --name layer-container base-layer
# Copy the generated zip artifact so our CDK can use it.
docker cp layer-container:layer.zip . && echo "Created layer.zip with updated base layer."

Docker build exits with exit code: 1 [duplicate]

This question already has answers here:
The command '/bin/sh -c apt-get install dnsutils' returned a non-zero code: 1
(2 answers)
Closed 1 year ago.
The aim is to have a Docker CLI in a Container, so I can Communicate with the Host Daemon from within this Container. Therefore I wanted to connect the socket's in the run Command.
I have a Dockerfile with the following start. The rest of the build works fine when I omit the Curl and Docker CLI part.
FROM ubuntu:20.04 as build
#might be even more slim, yet has not yet been tested: debian-stable-slim
RUN apt-get update \
&& apt-get install -y wget
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get update && \
apt-get install curl
## Install Docker CLI:
ENV DOCKERVERSION=20.10.9
RUN sudo curl https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz
This is the build log with error message:
[+] Building 3.2s (8/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 567B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 1.2s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [1/5] FROM docker.io/library/ubuntu:20.04#sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 0.0s
=> CACHED [2/5] RUN apt-get update && apt-get install -y wget 0.0s
=> CACHED [3/5] RUN apt-get update && apt-get -y install sudo 0.0s
=> ERROR [4/5] RUN apt-get update && apt-get install curl 1.9s
------
> [4/5] RUN apt-get update && apt-get install curl:
#8 0.395 Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
#8 0.415 Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
#8 0.441 Hit:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
#8 0.517 Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
#8 0.623 Reading package lists...
#8 1.142 Reading package lists...
#8 1.631 Building dependency tree...
#8 1.733 Reading state information...
#8 1.836 The following additional packages will be installed:
#8 1.836 krb5-locales libasn1-8-heimdal libbrotli1 libcurl4 libgssapi-krb5-2
#8 1.836 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
#8 1.836 libheimntlm0-heimdal libhx509-5-heimdal libk5crypto3 libkeyutils1
#8 1.836 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common
#8 1.836 libnghttp2-14 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules
#8 1.836 libsasl2-modules-db libsqlite3-0 libssh-4 libwind0-heimdal
#8 1.837 Suggested packages:
#8 1.837 krb5-doc krb5-user libsasl2-modules-gssapi-mit
#8 1.837 | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp
#8 1.837 libsasl2-modules-sql
#8 1.866 The following NEW packages will be installed:
#8 1.867 curl krb5-locales libasn1-8-heimdal libbrotli1 libcurl4 libgssapi-krb5-2
#8 1.867 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
#8 1.867 libheimntlm0-heimdal libhx509-5-heimdal libk5crypto3 libkeyutils1
#8 1.867 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common
#8 1.868 libnghttp2-14 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules
#8 1.869 libsasl2-modules-db libsqlite3-0 libssh-4 libwind0-heimdal
#8 1.874 0 upgraded, 27 newly installed, 0 to remove and 0 not upgraded.
#8 1.874 Need to get 3197 kB of archives.
#8 1.874 After this operation, 10.5 MB of additional disk space will be used.
#8 1.874 Do you want to continue? [Y/n] Abort.
------
executor failed running [/bin/sh -c apt-get update && apt-get install curl]: exit code: 1
there is no possibility to choose Y/n, because it exits instantly. Has anyone a Idea how to solve this?
Im Using Docker on Windows, Version 20.10.8
Thanks a lot!
apt get install will wait for user input. You're missing the -y flag to allow it to continue without human intervention:
RUN apt-get update && \
apt-get install -y curl

Docker centos php5 issues

I am trying to install php7 on centos using docker. I created my dockerfile like below.
FROM centos:7
WORKDIR /tmp
RUN \
yum update -y && \
yum install -y epel-release yum-plugin-ovl && \
yum install -y gcc wget git zip vixie-cron sendmail rsyslog
# Install Nginx
ADD config/nginx/nginx.repo /etc/yum.repos.d/nginx.repo
RUN \
yum install -y nginx
# Install php
RUN \
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && \
yum install -y yum-utils && \
yum-config-manager --enable webtatic-archive && \
yum install -y php70w php70w-devel php70w-pear && \
ln -s /usr/bin/php /usr/bin/php5
When I run the docker file I am getting the below error
> [ 6/34] RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && yum install -y yum-utils && yum-config-manager --enable webtatic-archive && yum install -y php70w php70w-devel php70w-pear && ln -s /usr/bin/php /usr/bin/php5:
#10 1.096 warning: /var/tmp/rpm-tmp.RubNcH: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
#10 1.209 Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#10 1.209 Preparing... ########################################
#10 1.210 Updating / installing...
#10 1.210 webtatic-release-7-3 ########################################
#10 1.310 Loaded plugins: fastestmirror, ovl
#10 1.346 Loading mirror speeds from cached hostfile
#10 7.700 Could not retrieve mirrorlist https://mirror.webtatic.com/yum/el7/aarch64/mirrorlist error was
#10 7.700 14: HTTPS Error 404 - Not Found
#10 7.707
#10 7.707
When I try the same one in my friends laptop all working as expected.
I am using Apple m1 chip.

Debian suddenly throws 'libcrypt.so.1: cannot open shared object file: No such file or directory' in Docker

I've been using the following Docker image (condensed for brevity) for a long time:
FROM elixir:1.11
ARG USER
ARG GROUP
ARG UID=1000
ARG GID=1000
ARG POSTGRESQL_VERSION=13
ARG POSTGRESQL_CLUSTER=my-cluster
ARG POSTGRESQL_PORT=5432
ARG POSTGRESQL_DIR=/etc/postgresql/$POSTGRESQL_VERSION/$POSTGRESQL_CLUSTER
ARG DEBIAN_FRONTEND=noninteractive
RUN set -xe \
&& ln -sf /usr/share/zoneinfo/Portugal /etc/localtime \
&& groupadd -g $GID $GROUP \
&& useradd -r -u $UID -g $GROUP -m -s /bin/bash -c "Docker image user" $USER \
&& apt-get update \
&& apt-get install -y lsb-release cmake \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
&& echo "deb http://deb.debian.org/debian `lsb_release -cs`-backports bullseye main" | tee -a /etc/apt/sources.list.d/pgdg.list \
&& echo "deb http://deb.debian.org/debian testing non-free contrib main" | tee -a /etc/apt/sources.list.d/pgdg.list \
&& wget -q -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get update \
&& apt-get install -y postgresql-$POSTGRESQL_VERSION inotify-tools libgit2-dev vim expect nodejs lsof
However, I suddenly started experiencing the following error:
#6 31.36 Get:131 http://deb.debian.org/debian testing/main amd64 vim amd64 2:8.2.2434-3 [1494 kB]
#6 31.64 debconf: delaying package configuration, since apt-utils is not installed
#6 31.85 Fetched 175 MB in 6s (30.9 MB/s)
#6 31.87 Selecting previously unselected package gcc-11-base:amd64.
(Reading database ... 36509 files and directories currently installed.)
#6 31.90 Preparing to unpack .../gcc-11-base_11.2.0-4_amd64.deb ...
#6 31.90 Unpacking gcc-11-base:amd64 (11.2.0-4) ...
#6 31.95 Setting up gcc-11-base:amd64 (11.2.0-4) ...
#6 32.00 Selecting previously unselected package libgcc-s1:amd64.
(Reading database ... 36514 files and directories currently installed.)
#6 32.02 Preparing to unpack .../libgcc-s1_11.2.0-4_amd64.deb ...
#6 32.03 Unpacking libgcc-s1:amd64 (11.2.0-4) ...
#6 32.03 Replacing files in old package libgcc1:amd64 (1:8.3.0-6) ...
#6 32.08 Setting up libgcc-s1:amd64 (11.2.0-4) ...
(Reading database ... 36516 files and directories currently installed.)
#6 32.17 Preparing to unpack .../g++_4%3a10.2.1-1_amd64.deb ...
#6 32.18 Unpacking g++ (4:10.2.1-1) over (4:8.3.0-1) ...
#6 32.21 Preparing to unpack .../gcc_4%3a10.2.1-1_amd64.deb ...
#6 32.22 Unpacking gcc (4:10.2.1-1) over (4:8.3.0-1) ...
(Reading database ... 36516 files and directories currently installed.)
#6 32.32 Removing g++-8 (8.3.0-6) ...
#6 32.41 dpkg: gcc-8: dependency problems, but removing anyway as you requested:
#6 32.41 libtool depends on gcc | c-compiler; however:
#6 32.41 Package gcc is not configured yet.
#6 32.41 Package c-compiler is not installed.
#6 32.41 Package gcc-8 which provides c-compiler is to be removed.
#6 32.41 Package gcc which provides c-compiler is not configured yet.
#6 32.41
#6 32.41 Removing gcc-8 (8.3.0-6) ...
#6 32.44 dpkg: libgcc-8-dev:amd64: dependency problems, but removing anyway as you requested:
#6 32.44 libstdc++-8-dev:amd64 depends on libgcc-8-dev (= 8.3.0-6).
#6 32.44
#6 32.44 Removing libgcc-8-dev:amd64 (8.3.0-6) ...
(Reading database ... 36304 files and directories currently installed.)
#6 32.55 Preparing to unpack .../libc6_2.31-17_amd64.deb ...
#6 32.66 Checking for services that may need to be restarted...
#6 32.67 Checking init scripts...
#6 32.69 Unpacking libc6:amd64 (2.31-17) over (2.28-10) ...
#6 33.57 Setting up libc6:amd64 (2.31-17) ...
#6 33.60 /usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
#6 33.60 dpkg: error processing package libc6:amd64 (--configure):
#6 33.60 installed libc6:amd64 package post-installation script subprocess returned error exit status 127
#6 33.61 Errors were encountered while processing:
#6 33.61 libc6:amd64
#6 33.72 E: Sub-process /usr/bin/dpkg returned an error code (1)
After trying certain changes and going by trial and error I believe the culprit is the command
echo "deb http://deb.debian.org/debian testing non-free contrib main" | tee -a /etc/apt/sources.list.d/pgdg.list
I'm suspicious of this being related to the recent release of Debian Bullseye, but I'm not sure. I need the testing repository to fetch a libgit2-dev version from 1.0.0 onwards (the stable repository download 0.27.0).
Some fixes I tried were installing libssl-dev and other crypto related packages but nothing seems to work so far. If I remove the command shown above it works, but installs the older version of libgit2.
Any help would be appreciated

How to install yq on Docker image python:3?

What I want to do
I want to install yq to edit some yaml files on a Docker container.
Dockerfile
FROM python:3
RUN apt-get update
RUN apt-key adv --keyserver keyserver.ubuntu.com --keyserver-option http-proxy=http://xxxxxx.com:9999 --recv-keys CC86BB64
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:rmescandon/yq
RUN apt update
RUN apt install yq -y
Reference
https://github.com/mikefarah/yq#on-ubuntu-1604-or-higher-from-debian-package
Build Logs
=> => transferring dockerfile: 486B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/python:3 0.0s
=> CACHED [1/7] FROM docker.io/library/python:3 0.0s
=> [2/7] RUN apt-get update 2.7s
=> [3/7] RUN apt-key adv --keyserver keyserver.ubuntu.com --keyserver-option http-proxy=http://xxxxxx.com:9999 --recv-keys CC86BB64 1.2s
=> [4/7] RUN apt-get install -y software-properties-common 11.4s
=> [5/7] RUN add-apt-repository ppa:rmescandon/yq 13.3s
=> ERROR [6/7] RUN apt update 1.8s
------
> [6/7] RUN apt update:
#9 0.159
#9 0.159 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#9 0.159
#9 0.205 Hit:1 http://deb.debian.org/debian buster InRelease
#9 0.205 Hit:2 http://security.debian.org/debian-security buster/updates InRelease
#9 0.227 Hit:3 http://deb.debian.org/debian buster-updates InRelease
#9 0.870 Ign:4 http://ppa.launchpad.net/rmescandon/yq/ubuntu impish InRelease
#9 1.356 Err:5 http://ppa.launchpad.net/rmescandon/yq/ubuntu impish Release
#9 1.356 404 Not Found [IP: 91.189.95.85 80]
#9 1.381 Reading package lists...
#9 1.752 E: The repository 'http://ppa.launchpad.net/rmescandon/yq/ubuntu impish Release' does not have a Release file.
------
executor failed running [/bin/sh -c apt update]: exit code: 100
Question
How can I fix it?
TL;DR
The PPA for yq is not available on the python:3 image's Linux distribution.
Change your Dockerfile to download the binary directly instead:
FROM python:3
RUN apt-get update
RUN apt-get install -y wget
# Latest on https://launchpad.net/~rmescandon/+archive/ubuntu/yq is 4.9.6
ARG VERSION=v4.9.6
ARG BINARY=yq_linux_386
RUN wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq \
&& chmod +x /usr/bin/yq
Explanation
The mentioned instructions for installing yq are expecting an Ubuntu-based image, but the python:3 Docker image is based on Debian 10 / Buster (as of the writing of this answer):
Dockerfile for python:3 = python:3.9 = python:3.9.6:
FROM buildpack-deps:buster
$ docker run -it python:3 bash
root#fa97b25dc0d3:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root#fa97b25dc0d3:/#
The error
E: The repository 'http://ppa.launchpad.net/rmescandon/yq/ubuntu impish Release' does not have a Release file.
means that the package ppa:rmescandon/yq does not support your distribution. You can check the supports distributions from http://ppa.launchpad.net/rmescandon/yq/ubuntu:
The workaround is to just install it from source or to just download the yq binary itself. This is supported by yq: https://github.com/mikefarah/yq#wget:
wget
Use wget to download the pre-compiled binaries:
Compressed via tar.gz
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - | tar xz && mv ${BINARY} /usr/bin/yq
Plain binary
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq && chmod +x /usr/bin/yq
For instance, VERSION=v4.2.0 and BINARY=yq_linux_amd64
Pick out a specific release from yq's Releases page (preferably matching one of the versions distributed for Ubuntu same as in the PPA) and modify your Dockerfile to:
FROM python:3
RUN apt-get update
RUN apt-get install -y wget
# Latest on https://launchpad.net/~rmescandon/+archive/ubuntu/yq is 4.9.6
ARG VERSION=v4.9.6
ARG BINARY=yq_linux_386
RUN wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq \
&& chmod +x /usr/bin/yq
Previous answer did not work in my case.
So this is my alternative solution:
Download the latest executable file of yq from GitHub:
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
Set execute permission for file:
RUN chmod a+x /usr/local/bin/yq
You can also get the yq in an image using,
FROM docker.io/mikefarah/yq:4.30.6 as yq
FROM python:3
COPY --from=yq "/usr/bin/yq" "/usr/local/bin/yq"
...

Resources