Docker containers defaulting to

I recently had an issue where docker containers were struggling with network connectivity. Connecting into one of the running containers, it was quickly established that the problems were due to DNS resolution not working. /etc/resolv.conf had populated itself with the Google public DNS servers ( & from somewhere…

The docker engine is meant to populate this with that of the parent OS, however in this case, the parent was running dnsmasq and had in its resolv.conf – So the docker engine had realized it was unlikely this this would work in a container, so substituted something supposedly helpful into the containers config – This usually would be helpful, but the environment I’m currently working in, only permits access to a few DNS servers.

We want to continue using dnsmasq on the Ubuntu host, so changing the contants of resolve.conf isn’t the way to go for us. Instead, we can force the docker engine to use nameservers of our choice by populating /etc/docker/daemon.json with the following:

    "dns": ["", ""]

(Obviously replacing with IPs, unless by some small miracle the above ones are the same as yours!)

docker service will also need a restart to pull in this config change.

Leave a Reply

Your email address will not be published. Required fields are marked *