DNS resolution inside of container isn't working


If I run the following from the host:
docker run -it ubuntu:14.04.3 /bin/bash

I can resolve bbc.co.uk and ping as expected, however if I create this container within rancher the container can’t resolve dns.

I looked in /etc/resolv.conf and the nameserver and are missing which I’d expect to be there because that’s what’s configured on the host.

Think I’m doing something silly. FWIW I had to change the host resolv.conf after I’d installed docker due to my host default machine build(OVH).


Edit : I’ve also set the DNS servers in the DOCKER_OPTS

The containers resolv.conf should contain, because all DNS requests are sent through the network agent container on the host to enable service discovery. It then forwards requests for public names to the recursive servers configured on the host.


Be certain you are not running Docker 1.11. I had similar problems, backed off to Docker 1.10.3, and everything starting working.

It appears OVH are running a custom kernel, I’v reinstalled the machine now and before installing docker switched the resolv.conf over. I then setting the DNS in docker_opts and now everything is working as expected.