dockerdockerfileapt

`apt-get update` never completes in Docker build


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

Solution

  • "Hello, have you tried turning it off and on again"?

    I just needed to restart the docker daemon.