Any Dockerfile I try to build, that includes apt-get update, just hangs indefinitely.
I can launch an image and run apt-get update inside the image with no problems.
docker run -it --entrypoint bash node:lts-bullseye
root#7b6ea3487aef:/# apt-get update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main arm64 Packages [120 kB]
Get:5 http://deb.debian.org/debian bullseye/main arm64 Packages [8070 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main arm64 Packages [2596 B]
Fetched 8392 kB in 2s (4936 kB/s)
Reading package lists... Done
root#7b6ea3487aef:/#
But if it's during the Docker build, it just hangs!
Update -
I installed lima and I'm able to build the image fine with -
lima nerdctl build .
So I think this must be Docker related
Dockerfile is nothing special - this is enough to reproduce the issue -
FROM node:lts-buster-slim
RUN apt-get update
"Hello, have you tried turning it off and on again"?
I just needed to restart the docker daemon.
Related
i am trying to build a docker from the tensorflow dockerhub, using tensorflow version 2.4.3, i did a simple pull and docker file:
$ docker pull tensorflow/tensorflow:2.4.2-gpu
And here is the dockerfile:
FROM tensorflow/tensorflow:2.4.3-gpu
ADD . /path
WORKDIR /path
RUN apt-get -y update
RUN apt-get -y install sudo
However i get errors on the apt-get update line:
$ docker build -t tensorflow_gpu_build .
...
Step 4/10 : RUN apt-get -y update
---> Running in 7c67f26124cb
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease [1581 B]
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1573 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [83.3 kB]
Err:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease
The following signatures couldn''t be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
Get:7 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [3145 kB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [1371 kB]
Ign:9 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 InRelease
Hit:10 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 Release
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [1412 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [22.9 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2351 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [3568 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [30.8 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [64.0 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [20.5 kB]
Reading package lists...
W: GPG error: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease: The following signatures couldn''t be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
E: The repository 'https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease' is no longer signed.
I am unsure of where the problem is coming from, the same dockerfile worked fine on the latest tensorfow docker version, could it be normal behaviour because the tensorflow version is a little old?
It's possible that the key included in the image has been revoked by Nvidia in the meantime.
So, you have three possibilities:
You can check for a valid pub key for that repository, copy it to the image via Dockerfile and add it with this command:
apt-key add /path/to/key
You can add an "[ allow-insecure=yes ]" to the respective line in the /etc/apt/sources.list as elaborated here: https://unix.stackexchange.com/questions/198000/bypass-gpg-signature-checks-only-for-a-single-repository
You could try a newer image.
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
The community reviewed whether to reopen this question last month and left it closed:
Original close reason(s) were not resolved
Improve this question
I currently don't manage to run apt update inside a fresh ubuntu:22.04 (codename jammy).
Protocol
$ docker --version
Docker version 20.10.2, build 2291f61
$ docker run --init --rm -it ubuntu:22.04
root#123456789:/# apt update
Observed
$ docker run --init --rm -it ubuntu:22.04
root#6444bf2cb8b4:/# apt update
Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [90.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [90.7 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security InRelease [90.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
Fetched 20.2 MB in 1s (17.6 MB/s)
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code
root#6444bf2cb8b4:/#
Expected
apt update pass like on a ubuntu:20.04 base image...
note: same issue with apt-get install ...
ref: https://hub.docker.com/_/ubuntu
Seems this is related to the use of the syscall clone3 by Glibc >= 2.34...
So you need Docker >= 20.10.9 to fix it.
ref: https://github.com/moby/moby/pull/42681
ref: https://pascalroeleven.nl/2021/09/09/ubuntu-21-10-and-fedora-35-in-docker/
I ran into the same issue. Here is my tactical work-around.
For context ...
I am working inside a Gitpod instance.
$ docker --version
Docker version 20.10.12, build e91ed57
$ docker pull ubuntu:22.04
$ docker run --rm -it ubuntu:22.04 /bin/bash
root#2fcf92fb7c84:/# apt update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [90.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [90.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [90.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
Get:6 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
Fetched 20.2 MB in 2s (11.1 MB/s)
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code
Quick nano install ...
Despite the error message above, the update was sufficient to install nano. I ignore the misleading error message at the end of the nano install.
root#3958950e9c57:/# apt install nano
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
:
E: Problem executing scripts DPkg::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code
My fix ...
I use nano to edit /etc/apt/apt.conf.d/docker-clean, commenting out the second line (APT::...). I subsequently ran into a similar error message with line 1 (DPkg::...); so, it too gets commented out.
It might be okay to just remove docker-clean all together; but for now, I have left one line in place.
Both '//' and '#' can be used to comment out lines.
root#3958950e9c57:/# nano /etc/apt/apt.conf.d/docker-clean
.. nano session not shown ..
root#3958950e9c57:/# cat /etc/apt/apt.conf.d/docker-clean
# DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };
# APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };
Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";
The results ...
The confusing message resulting from the now commented-out lines is gone.
root#beab61fbde20:/# apt update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Required Improvement ...
A better solution would be to repair the line that I have commented out. I was not able to find the right edits; so, just left the line commented out.
In Docker ...
I use sed in lieu of nano.
FROM ubuntu:22.04
USER root
RUN sed -i -e 's/^APT/# APT/' -e 's/^DPkg/# DPkg/' \
/etc/apt/apt.conf.d/docker-clean
Then, tag an adjusted Ubuntu image for local use.
docker build -t fixed-ubuntu:22.04 -f Dockerfile .
I upgraded docker engine to version 20.10.14 and it resolved the problem.
I had docker 20.10.18 (latest at time writing) which didn't work, with 20.10.14 it started to work.
I was trying to install zeppelin as shown in this dockerfile, but with a different version of spark and hadoop (see this dockerfile in my repo for more details). However, I am getting the following error log when running apt-get update:
Step 5/10 : RUN apt-get update
---> Running in 1ee84513acc7
Ign http://ftp.debian.org jessie-backports InRelease
Ign http://ftp.debian.org jessie-backports Release.gpg
Ign http://deb.debian.org jessie InRelease
Ign http://ftp.debian.org jessie-backports Release
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Err http://ftp.debian.org jessie-backports/main amd64 Packages
Get:2 http://deb.debian.org jessie-updates InRelease [16.3 kB]
Err http://ftp.debian.org jessie-backports/main amd64 Packages
Err http://ftp.debian.org jessie-backports/main amd64 Packages
Get:3 http://deb.debian.org jessie Release.gpg [1652 B]
Err http://ftp.debian.org jessie-backports/main amd64 Packages
Get:4 http://deb.debian.org jessie-updates/main amd64 Packages [20 B]
Get:5 http://security.debian.org jessie/updates/main amd64 Packages [992 kB]
Err http://ftp.debian.org jessie-backports/main amd64 Packages
404 Not Found
Get:6 http://deb.debian.org jessie Release [77.3 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
W: Size of file /var/lib/apt/lists/deb.debian.org_debian_dists_jessie-updates_main_binary-amd64_Packages.gz is not what the server reported 20 23046
W: Failed to fetch http://ftp.debian.org/debian/dists/jessie-backports/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Fetched 10.2 MB in 1s (7375 kB/s)
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
ERROR: Service 'zeppelin' failed to build
It seems like this is somehow related to the jessie package. I read this and this article and I tried including
RUN echo "deb [check-valid-until=no] http://cdn-fastly.deb.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
RUN apt-get -o Acquire::Check-Valid-Until=false update
script before the apt-get update command in the dockerfile of my repo, but still without success.
I want to build a docker image based on php:5.6.32-apache.
The content involved in this within my Dockerfile is:
FROM php:5.6.32-apache
....
RUN apt-get update -y
The console output from the built process is:
Step 6/10 : RUN apt-get update -y
---> Running in 8781a7a005ad
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [7340 B]
Get:3 http://deb.debian.org jessie Release.gpg [2420 B]
Get:4 http://deb.debian.org jessie Release [148 kB]
Get:5 http://security.debian.org jessie/updates/main amd64 Packages [846 kB]
Get:6 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease Unable to find expected entry 'main/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)
E: Some index files failed to download. They have been ignored, or old ones used instead.
Fetched 10.1 MB in 17s (565 kB/s)
ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-get update -y' returned a non-zero code: 100
You can find the original php:5.6.32-apache Dockerfile here:
https://github.com/docker-library/php/blob/ec6b6e60b42c283d48775596f722f5250c1f5ca5/5.6/jessie/apache/Dockerfile
Duplicate. Please find solution at:
Build Error. Failed to fetch Build Error. Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
When I run docker on local machine with following Dockerfile:
FROM python:3
WORKDIR /app
COPY . /app
RUN apt-get update && apt-get install -y libhunspell-1.3-0
RUN pip install -r requirements.txt
EXPOSE 9876
CMD ["python","flask_compose.py"]
It got libhunspell from following repository (jessie):
Get:1 http://security.debian.org jessie/updates InRelease [94.4 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [623 kB]
Get:4 http://deb.debian.org jessie Release.gpg [2434 B]
Get:5 http://deb.debian.org jessie Release [148 kB]
Get:6 http://deb.debian.org jessie-updates/main amd64 Packages [23.0 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
And everything is fine (image build and run successfully).
Unfortunately, when I run docker on gitlab repository with the same Dockerfile it calls update apt-get from another repository (stretch):
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 http://deb.debian.org/debian stretch Release [118 kB]
Get:5 http://deb.debian.org/debian stretch Release.gpg [2434 B]
Get:6 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [440 kB]
Get:7 http://deb.debian.org/debian stretch-updates/main amd64 Packages [12.1 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 Packages [9530 kB]
Due to this inconsistency gitlab CI/CD throws following exception:
E: Unable to locate package libhunspell-1.3-0
E: Couldn't find any package by glob 'libhunspell-1.3-0'
E: Couldn't find any package by regex 'libhunspell-1.3-0'
The command '/bin/sh -c apt-get install -y libhunspell-1.3-0' returned a non-zero code: 100
ERROR: Job failed: exit code 100
Does anyone knows how change my Dockerfile that local and gitlab uses the same package repository?
There current tag for python:3 points to a Debian stretch based image. To update your local environment, run a docker pull python:3 or run your build with the --pull option.
You can also select a more specific tag to force your desired base image used by python. See the docker hub page for python to see all the possible tags, e.g. python:3-jessie.
From gitlab official forum I found a solution which fixed my problem.
1) define a setup.sh file and following command:
echo "deb http://pkg.adfinis-sygroup.ch/debian/ jessie main non-free contrib" > /etc/apt/sources.list
echo "deb http://security.debian.org/ jessie/updates main" >> /etc/apt/sources.list
echo "deb http://pkg.adfinis-sygroup.ch/debian/ jessie-updates main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install --no-install-recommends -y libhunspell-1.3-0
2) In Dockerfile add following commands:
From python:3
ADD setup.sh /opt/
RUN /bin/bash /opt/setup.sh
PS: Although my hack works very fine, I prefer #BMitch solution.
--------------------------------------------------------------------------------------------------------
By extending #Bmitch solution I decrease image size from ~600 to ~150 with following Dockerfile:
FROM python:3-slim-jessie
WORKDIR .
# hunspell deps
RUN apt-get update && apt-get install --no-install-recommends -y libtool libc6-dev gcc g++ build-essential libhunspell-1.3-0
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
CMD ["python","flask_compose.py"]