Running a (slightly modified) Ubuntu:16.04 docker image, cannot access DNS servers. This is evidenced by being able to ping a resolved ip address for google.com (such as, which was resolved on a different computer), but not being able to ping google.com.

root@12345678910:/# ping -c 1
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=46 time=20.5 ms
--- ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 20.551/20.551/20.551/0.000 ms

root@12345678910:/# ping -c 1 google.com   
ping: unknown host google.com

Most of my googling turns up issues about setting DNS flags. However I have tried setting the DOCKER_OPTS variable in /etc/default/docker to point to many DNS servers:

DOCKER_OPTS="--dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns --dns"

as well as setting the DNS variable in /etc/docker/daemon.json (as described here):

  "dns": [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ]

with no success for either attempt.

(These are all the IP addresses to DNS servers listed on lifewire)

One option I wanted to try was to reset the ip tables and network bridge, but this suggestion is too old to trust (for example docker -d is no longer a valid command)

A possible issue is that this machine is on university Ethernet, and had to be white-listed with the machine's Ethernet hardware address. On the Ubuntu16 host machine, this was the eno1 device (if I'm using the correct term). My first thought was that, since the docker0 hardware address is different, maybe the university network is blocking that traffic. But I dont think this is the issue because I can still ping the raw IP address. Maybe something is lost in translation when querying DNS?

Any suggestions?

Version info:

  • Host: Linux hostname 4.4.0-92-generic #115-Ubuntu SMP Thu Aug 10 09:04:33 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Container: ubuntu:16.04 with the host's ping copied over (can't install with apt without internet).
  • Docker: Docker version 1.12.6, build 78d1802

This ended up being an issue with the university network. My understanding is that they were somehow blocking DNS requests, and we were instructed to use their internal DNS server address for in our docker's configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.