Docker on Ubuntu 14.04 - Could not resolve 'archive.ubuntu.com'

July 17, 2014 28.9k views

Hi,

I've having an issue with Docker 1.1.1 on my Ubuntu 14.04 VPS in the London zone.

I'm getting the following output when executing docker run --name="test" ubuntu:14.04 apt-get update,

Err http://archive.ubuntu.com trusty InRelease

Err http://archive.ubuntu.com trusty-updates InRelease

Err http://archive.ubuntu.com trusty-security InRelease

Err http://archive.ubuntu.com trusty Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-security Release.gpg
  Could not resolve 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease  

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease  

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/InRelease  

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'archive.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could not resolve 'archive.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Could not resolve 'archive.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.

I've done some Googling, but couldn't find anything that was related to this specifically. /etc/resolv.conf contains the same contents as the parent VPS, which are,

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888
nameserver 209.244.0.3

Anyone have any ideas? Possibly IPv6 related as per https://lists.debian.org/deity/2014/05/msg00036.html?

Steve

2 Answers

As suspected, this is due to IPv6 being enabled on my droplet. See here.

For now, my fix was to remove the IPv6 nameservers from my /etc/resolv.conf. You can also use the --dns argument when running docker.

  • Hi!

    Thanks for figuring this out and following up! Remember you can also set DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4" in /etc/default/docker so that you don't need to use the command line argument every time.

does this help: http://dannytsang.co.uk/docker-on-digitalocean-cannot-resolve-hostnames/ ? Apparently docker cannot resolv hostnames with IPv6 nameservers

Have another answer? Share your knowledge.