docker-alpine: Temporary error (try again later)
I run into this issue when building a docker image on Ubuntu Host. The Same build on Windows 10 using docker-tools CLI (so technically inside a VirtualBox VM) has no issues and Docker images are built correctly.
I have reinstalled Docker on my Ubuntu completely to have a fresh version just in case. Any suggestions what else I can do to troubleshoot this issue?
Build command output
Sending build context to Docker daemon 572.4kB
Step 1/15 : FROM alpine:edge
edge: Pulling from library/alpine
cc5efb633992: Pull complete
Digest: sha256:2b796ae57cb164a11ce4dcc9e62a9ad10b64b38c4cc9748e456b5c11a19dc0f3
Status: Downloaded newer image for alpine:edge
---> f96c4363411f
Step 2/15 : RUN apk add --update nodejs
---> Running in 12865b082f34
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/edge/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.066df28d.tar.gz: No such file or directory
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/edge/community: temporary error (try again later)
WARNING: Ignoring APKINDEX.b53994b4.tar.gz: No such file or directory
ERROR: unsatisfiable constraints:
nodejs (missing):
required by: world[nodejs]
The command '/bin/sh -c apk add --update nodejs' returned a non-zero code: 1
My dockerfile
FROM alpine:edge
RUN apk add --update nodejs
#create an app directory
RUN mkdir -p /app
WORKDIR /app
# create some useful folders
RUN mkdir -p /data
# Copy apps build in another folder
COPY main.js /app
COPY package.json /app
COPY version.json /app
COPY dist /app/dist
COPY data /data
COPY app_modules /app/app_modules
COPY node_modules /app/node_modules
#expose the port
EXPOSE 5555
#start the app
#ENV NODE_ENV=development
#ENV debug=true
WORKDIR /app
# comment if need a console in the container
CMD [ "node", "main.js" ]
About this issue
- Original URL
- State: open
- Created 9 years ago
- Comments: 73 (3 by maintainers)
Commits related to this issue
- Use host network when building our custom zip image See https://github.com/gliderlabs/docker-alpine/issues/334#issuecomment-461788017 — committed to WaveHack/intranet by WaveHack 4 years ago
@andyshinn , RE: https://github.com/gliderlabs/docker-alpine/issues/334#issuecomment-330096922
It was a DNS error for me. By setting
/etc/docker/daemon.jsonwith,and then restarting docker with,
I was able to build images again.
Since there are times when the bridge is disturbing, it is successful if you execute it as host.
docker build -t hoge:latest . --network=hostI had this error with Gitlab, i just change docker build command to run with --network host option and it works!
Hit the same problem (again) on Windows + Docker and tried many suggested (in #279) solutions, involving changing apk settings in Dockerfile and such. but nothing helped. What did help finally was to restart Docker and then apk just pulled the APKINDEX like nobody’s business.
For Raspberry Pi:
[source]
[source]
If you’re building an image via docker-compose you might try the following to use the host network at build time:
@wlechowicz restart docker service solved my issue 👍
restarting docker service maybe help you
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.confhelped on Ubuntu 16 build agent to make CI jobs build alpine based docker images again as per https://github.com/gliderlabs/docker-alpine/issues/279#issuecomment-411982620-In Windows
And add this line.
any idea how to add this workaround using docker-compose ? the --network flag is not available there
Just for reference, I got a similar error, but in my case it was a problem with nftables:
Stopping nftables and restarting docker will give the container internet access.
@minecraftchest1 Just got the ‘temporary error’ problem myself:
I tried a few different solutions, including explicitly defining DNS servers in the docker-compose file and in /etc/docker/daemon.json, to no avail.
For me, adding
network: hostto my docker-compose file fixed the problem:This keeps popping up in other threads and I wonder if there might be a change in the way Fastly is doing DNS. To debug this we really need to see the output of something like
curl -v -s http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz > /dev/nullto get headers and the HTTP response from within a container. My guess is a temporary issue with a Fastly POP or a change in POP IP address that hasn’t yet properly timed out in Docker DNS proxy yet.After struggling for so long with what I though was a kubernetes specific docker-in-docker issue, I ended up adding the
--network=hostin my scripts commands and it fixed it. I should have tried that first instead of going nuts.same problem. It will be great if someone can advise. Restarting docker or reboot is no go for my case
Same issue trying to build
python:3.11-alpine. Solved by adding another dns, like ‘9.9.9.9’ (Quad9), in my existing list in/etc/docker/daemon.json:as described in previous comment > https://github.com/gliderlabs/docker-alpine/issues/334#issuecomment-1135351701
Run docker build command to run with --network=host option and it works
same problem here . I tried many many times … it is not a bad server … it seams a bad code line , a bug
@andyshinn I’ll see if I can provide you with the output. However, I believe the issue is in Docker Engine, and possibly in DNS caching. My Host Machine was on the corporate network 1, but when we switched it to corporate network 2, the issue was gone. After speaking to networking people, they weren’t able to tell how the difference between networks could have affected the Docker Build. It points to a combination of DNS and Docker Engine. However, we ruled out the DNS, because on both networks we were able to do curl from the host and download the .gz files.
I checked my docker config and its DNS is set to 8.8.8.8 and 8.8.4.4. From both networks these IPs are reachable.
Another data point for those who stumble upon this thread: my issue was with Tailscale, needed to turn off stateful filtering with
tailscale up --stateful-filtering=falseSee https://tailscale.com/s/stateful-docker
I used the host network mode to run alpine and the issue was solved:
I had the same issue. Changing the Alpin version solved mine. alpin:3.6
Solved using:
$ docker build . -t rancher-demo --network=host
Thank YOU!
I also had this issue randomly building
ingress-nginximages on Docker Desktop.I added the
"dns": ["8.8.8.8"]line to the Docker Desktop config and now it builds consistently.Actual version is 2.5.3-2
For Raspberry Pi, you can upgrade libseccomp2 to a supported version from the Debian Repos eg.
Hi, I had the same problem. Docker build creates a container in the default bridge network that will generate the image. Firewalld was blocking the traffic. If this is your case and would still like to use firewalld, you can follow this blog where the interesting part is:
If the zone doesn’t exist please create it beforehand.
To get the default network ip range, you can execute
docker network inspect bridgewhere “bridge” is the default network name.For me it was the firewall blocking it. Turned it off temporarily with
sudo systemctl stop firewalldand it built just fine.Ignore everything below, it was an IPV6 problem, not related
Figured it out what caused it for me. I had enabled IPV6 on my host and that caused the only DNS server in /etc/resolv.conf to also be IPV6. Disabling IPV6 again caused the build to run through. I could pretty much consistently trigger a failed/successful build by switching between an IPV6 DNS server and an IPV4 DNS server.
Some more info: OS: Debian 12 OCI: Podman Network changes relevant:
sudo nano /etc/network/interfacesand then adding(Replace eth0 with whatever your actual network interface is) Then just restart networking (sudo service networking restart)
As soon as you get the files once it won’t reproduce until you clear all the build caches.
I ran into the same
apkfailure with (rootless) podman. Strangely enough,nslookupworked fine from within the container!What worked for me was setting the global dns, i.e.
/etc/containers/containers.conf:Same problem. I’m using Manjaro and none of the solutions worked for me
Other mirrors do work. I suppose I have to go dig and see if they hard coded a mirror or something. It’s odd though that it breaks apk so hard. I suppose I would have thought it to be more resilient
Its in general, related to DNS/apk fragility, but I think perhaps a different issue then op:
https://github.com/laradock/laradock/issues/749#issuecomment-293296687