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 7 years ago
  • Comments: 65 (3 by maintainers)

Commits related to this issue

Most upvoted comments

@andyshinn , RE: https://github.com/gliderlabs/docker-alpine/issues/334#issuecomment-330096922

It was a DNS error for me. By setting /etc/docker/daemon.json with,

{
  "dns": ["8.8.8.8"]
}

and then restarting docker with,

sudo service docker restart

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=host

I 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:

The answer is this: https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.13.0#time64_requirements (alpine 3.13 isn’t compatible with raspberry pi os by default due to some outdated package)

[source]

For Raspberry Pi, you can upgrade libseccomp2 to a supported version from the Debian Repos eg.

wget http://ftp.de.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_armhf.deb
dpkg -i libseccomp2_2.5.1-1_armhf.deb

[source]

If you’re building an image via docker-compose you might try the following to use the host network at build time:

version: "3.7"

services:
  my_service:
    build:
      context: .
      network: host # this line is the trick

restarting docker service maybe help you

@wlechowicz restart docker service solved my issue 👍

sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf helped 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

@minecraftchest1 Just got the ‘temporary error’ problem myself:

fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:
  ...

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: host to my docker-compose file fixed the problem:

version: "3.9"
services:
  backend:
    build:
      context: .
      dockerfile: ...
      network: host    <--- this fixed it

any idea how to add this workaround using docker-compose ? the --network flag is not available there

@andyshinn , RE: #334 (comment)

It was a DNS error for me. By setting /etc/docker/daemon.json with,

{
  "dns": ["8.8.8.8"]
}

and then restarting docker with,

sudo service docker restart

I was able to build images again.

-In Windows

C:\Users\Administrator\.docker\daemon.json


And add this line.

{
    ...
    "dns": ["8.8.8.8"]
}

Just for reference, I got a similar error, but in my case it was a problem with nftables:

 ---> Running in 2522cf9dc903
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:

Stopping nftables and restarting docker will give the container internet access.

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/null to 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.

any idea how to add this workaround using docker-compose ? the --network flag is not available there

same problem. It will be great if someone can advise. Restarting docker or reboot is no go for my case

Since there are times when the bridge is disturbing, it is successful if you execute it as host. docker build -t hoge:latest . --network=host

After struggling for so long with what I though was a kubernetes specific docker-in-docker issue, I ended up adding the --network=host in my scripts commands and it fixed it. I should have tried that first instead of going nuts.

I had the same issue. Changing the Alpin version solved mine. alpin:3.6

Since there are times when the bridge is disturbing, it is successful if you execute it as host. docker build -t hoge:latest . --network=host

Solved using:

$ docker build . -t rancher-demo --network=host

Thank YOU!

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.

I used the host network mode to run alpine and the issue was solved:

docker run -it --network host alpine

Actual version is 2.5.3-2

For Raspberry Pi, you can upgrade libseccomp2 to a supported version from the Debian Repos eg.

wget http://ftp.de.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.3-2_armhf.deb
dpkg -i libseccomp2_2.5.3-2_armhf.deb

Run docker build command to run with --network=host option and it works

any idea how to add this workaround using docker-compose ? the --network flag is not available there

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