Another recently encountered problem: how to make Docker container DNS work when the configured DNS server is blocked.

The answer is simple:

/etc/docker/daemon.json contains the docker daemon configuration, and you can specify additional defaults. In this case, I added my local DNS server first, followed by the Google public DNS server (which I prefer not to use generally, but am OK with a docker container using).

/etc/docker/daemon.json { “dns”: [“192.168.1.1”, “8.8.8.8”] }

I wonder if there’s a market for a docker image with a basic caching resolver like dnscache already configured? It’s small, efficient, and removes the need for overriding configurations like this.