Skip to content

Instantly share code, notes, and snippets.

Last active Dec 30, 2016
What would you like to do?
dnsdock working on systemd for a dummy guy like me :|


If you didin't get the instructions on the git repo of DnsDock, let's take a step back.

Follow these steps to install DNSDock on your Ubuntu machine:

1. Set BIP (bridge ip) for docker0 interface.

It's better to set an address, cause docker can change addresses between versions. We need to edit /lib/systemd/system/docker.service

Use the editor of your choice. I like vim: sudo vim /lib/systemd/system/docker.service

Add these two options after "... -H fd://" on the ExecStart directive. The options are: --bip= --dns=

In addition to BIP, we are telling docker to use the same address as DNS: Any discovery will pass through this address.

Restart daemons: sudo systemctl daemon-reload

Restart docker: sudo systemctl restart docker

2. Optional: Make discovery available to the host machine

This step is optional. I like to access containers via their addresses, like:, xxx.service.docker, db.enterprise.rgs...

To make it work, edit /etc/resolvconf/resolvconf.d/head. So edit that file and add: nameserver Note that is the same address as DNS option set on step #1

Update resolvconf: sudo resolvconf -u

3. Now you can start a dnsdock container

sudo docker run --rm -d -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p tonistiigi/dnsdock

Relate to the git repo to have more options. Note that I'm using --rm instead of -d to force container removal after I stop them. It's useful when testing the various options of DnsDock.


I found that docker0 default address, on Ubuntu 16.04 and docker 1.11, is I made it work with that address first.

To know what is the adress of docker0 run route. A list of network addresses will come up. docker0 ->

Using ifconfig you can get more info on the docker0 interface, like the connection ip address. Simply the first available ip on the network:

Some docker versions ago, the default bridge address was different. Was something like:


Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         UG    600    0        0 wlp3s0
link-local      *          U     1000   0        0 docker0      *          U     0      0        0 docker0    *        U     600    0        0 wlp3s0


docker0   Link encap:Ethernet  HWaddr 02:42:95:09:db:39  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::42:95ff:fe09:db39/64 Scope:Link
          RX packets:76 errors:0 dropped:0 overruns:0 frame:0
          TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:6057 (6.0 KB)  TX bytes:4248 (4.2 KB)

Going further.

After making it work (we pay the price of our stupidity), I've found some good sources to take another step:

Thanks Tõnis Tiigi for the awesome work!!!

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