Docker Community Forums

Share and learn in the Docker community.

Docker DNS broken

build
dns

(Ocket8888) #1

Somehow, Docker’s DNS has been obliterated.

I have this simple Dockerfile:

FROM ubuntu:latest
RUN apt update
RUN apt install -y curl

which fails to build (I’ve also tried similar things with other base images e.g. alpine:latest with the same effect).
The output from the build process is:

Sending build context to Docker daemon  2.048kB
Step 1/5 : FROM ubuntu:latest
latest: Pulling from library/ubuntu
473ede7ed136: Pull complete 
c46b5fa4d940: Pull complete 
93ae3df89c92: Pull complete 
6b1eed27cade: Pull complete 
Digest: sha256:29934af957c53004d7fb6340139880d23fb1952505a15d69a03af0d1418878cb
Status: Downloaded newer image for ubuntu:latest
 ---> ea4c82dcd15a
Step 2/5 : RUN apt-get update
 ---> Running in 8d6e67a4a358
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Removing intermediate container 8d6e67a4a358
 ---> 25e92c5a2ef8
Step 3/5 : RUN apt-get install -y curl
 ---> Running in 4b43b521ad28
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package curl
The command '/bin/sh -c apt-get install -y curl' returned a non-zero code: 100

My docker version is “Docker version 18.06.1-ce, build e68fc7a”, I’m running it on Linux Mint 18.3 Cinnamon 64-bit, and I’ve done apt purge docker-ce && apt install -y docker-ce to no effect. I have no running containers or networks (did a docker system prune -af between each test). How can I fix this?

EDIT: I genuinely have no idea what could have caused this.


(Martin Terp) #2

Can you try building your image with:

docker build --network=host ..

are you able to resolve “archive.ubuntu.com” from the host?


(Ocket8888) #3

yes, I can easily reach any hostname from my host that my docker images say are unresolvable (e.g. the apk repos as well as archive.ubuntu.com)


(Ocket8888) #4

Also just confirmed that it works with --network=host