Taming dnsmasq and Docker containers, an Ubuntu 16.04 LTS story

Foreword, by default Docker daemon pass to container DNS from /etc/resolv.conf file from the host machine, except local addresses. Ubuntu 16.04 LTS Network Manager use dnsmasq by default, so in the Docker host /etc/resolv.conf there is only a 127.0.0.1 entry. In this configuration Docker daemon pass to container Google public DNS by default :)

https://docs.docker.com/engine/userguide/networking/configure-dns/

If you working with VPN, custom DNS configuration or simply you change host machine DNS after container startup you got in trouble if your containers needs those DNS.

TL;DR

and

and

/etc/init.d/network-manager stop && /etc/init.d/network-manager start

after that you can monitor every dnsmasq resolution from /var/log/syslog

credits

https://robinwinslow.uk/2016/06/23/fix-docker-networking-dns/
http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html