Set custom DNS for Docker to use

Did you know Docker internally uses Google DNS (, to resolve all domains when downloading images or installing dependencies while building images ?

Recently while building Smart Display with Phoenix LiveView I found that’s the case when suddenly all new image downloads or build dependencies that were not cached started failing. As I run my own Ad blocking VPN with DoH and have a sink setup on my router for Google DNS as many of the devices for e.g Chromecast come hard coded with Google DNS to allow serving ads and geo lock your content.

Initially I couldn’t figure out what could be the cause as this was something unexpected that docker by default is using Google DNS if nothing is configured.

First I had to update in /etc/default/docker for docker to be able to download dependencies

but I hit a wall when the images that were not available locally started to fail as well up on further digging through found online that DNS config should also be updated in /etc/docker/daemon.json

For now this has resolved my Docker DNS issues and all images and dependencies are working well.

Originally published at on January 10, 2021.

Coder during the day, squash player in the evening and cricketer over the weekends. Doubts are the ants in the pants, that keep faith moving

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store