git clone https://github.com/xieyunzi/docker-dnsmasq
mkdir data && cp dnsmasq.conf.example data/dnsmasq.conf
# mkdir data/dnsmasq.d && vim data/dnsmasq.d/dnsmasq.conf
docker-compose up -d
sudo networksetup -listallnetworkservices
sudo networksetup -setdnsservers <networkservice> 127.0.0.1 192.168.1.1 8.8.8.8
nslookup domain.com (or use `dig`)
should got
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: domain.com
Address: 192.168.1.1
google search :P
As you probably know Google Chrome has its own internal DNS cache. Need to both clear the host cache and flush the socket pools to get Chrome to refresh the DNS cache:
- Navigate to [chrome://net-internals/#dns][1] and click "Clear Host Cache"
- Navigate to [chrome://net-internals/#sockets][2] abd click "Flush Socket Pools"
also http://superuser.com/questions/723703/why-is-chromium-bypassing-etc-hosts-and-dnsmasq
Built-in DNS uses the wrong DNS server "Internal DNS client enabled" is a problem with VPN or local cache servers
so to fix this problem, i just remove '8.8.8.8' from my DNS list
do this command inside the folder where the docker-compose.yml
file
To up docker service
$ docker-compose up -d --remove-orphans
Bring down $ docker-compose down
To show the stats: $ docker-compose logs -f #run this on seperate terminal $ docker kill -s USR1 docker-dnsmasq_dnsmasq_1 #run on seperate terminal