Skip to content

Instantly share code, notes, and snippets.

@cameronmaske
Last active June 3, 2017 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cameronmaske/f89664f68ac63bb4f5899b575a2f94ec to your computer and use it in GitHub Desktop.
Save cameronmaske/f89664f68ac63bb4f5899b575a2f94ec to your computer and use it in GitHub Desktop.
Setting up Docker DNS for local dev

After setting up your docker machine, change the dns opts to look for a locally running DNS server...

docker-machine ssh
sudo vi /var/lib/boot2docker/profile
# Then add the following...
EXTRA_ARGS='
--label provider=virtualbox
--dns 172.17.0.1
--dns-search dev
'

Then run the following container...

docker run -d -v /var/run/docker.sock:/var/run/docker.sock --restart="always" --name dnsdock -p 172.17.0.1:53:53/udp aacebedo/dnsdock

Then install dnsmasq

brew install dnsmasq

And create the file with /usr/local/etc/dnsmasq.conf

address=/dev/192.168.99.100

(The ip comes from docker-machine ip)

sudo route -n add 172.17.0.0/16 $(docker-machine ip)

https://www.snip2code.com/Snippet/1164048/custom-docker-wrapper-for-osx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment