Docker DNS broken

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 bionic InRelease
  Temporary failure resolving ''
Err:2 bionic-security InRelease
  Temporary failure resolving ''
Err:3 bionic-updates InRelease
  Temporary failure resolving ''
Err:4 bionic-backports InRelease
  Temporary failure resolving ''
Reading package lists...
W: Failed to fetch  Temporary failure resolving ''
W: Failed to fetch  Temporary failure resolving ''
W: Failed to fetch  Temporary failure resolving ''
W: Failed to fetch  Temporary failure resolving ''
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.

Can you try building your image with:

docker build --network=host ..

are you able to resolve “” from the host?

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

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

1 Like