No description or website provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Docker developer DNS

This DNS purpose is to allow for developers to run their development environments without the need to update their /etc/hosts file. The additional goal is to allow us to run a debug environment locally on the same domainname as the 'live' environment. For now this DNS will be aimed at Linux users, over time the goal is to provide a consistent platform for more operating systems.

This DNS will not try to create DNS entries for all running containers. You must define what containers you want to be available in the DNS by using VIRTUAL_HOST or DOMAIN_NAME.


  1. Install developer-dns
  2. Resolve developer-dns
  3. Register docker containers


To run this DNS server we need access to the docker socket so the DNS entries can be added dynamically.


$ docker run --name developer-dns \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p \

systemd service:

You can find the basic systemd service file in contrib/systemd.

Description=developer-dns docker.service

ExecStartPre=-/usr/bin/docker rm developer-dns
ExecStart=/usr/bin/docker run --rm --name developer-dns \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p \
    -p \
ExecStartPost=-/usr/bin/docker pull blackikeeagle/developer-dns
ExecStop=/usr/bin/docker stop developer-dns


To add support for changing networks you can add your dhcp received resolv.conf to the container. To achieve this you must install openresolv and make use of the resolvconf.conf file. In some distributions you get a default configuration that stores files in tmp space which can lead to some issues. So it's better to use a target location within /etc as used in the file in contrib.

Add resolv.conf to the container:

    -v /etc/dnsmasq-resolv.conf:/etc/resolv.conf:ro

Let a container have a DNS entry

You can use both VIRTUAL_HOST and DOMAIN_NAME environment variables to get an entry or comma seperated to add entries to the developer-dns.

single dns entry:

$ docker run --env nginx
$ docker run --env memcached

When dealing with webservers you might want to add more:

$ docker run --env,,, nginx
$ docker run --env,,, nginx

Personally I would recommend to use VIRTUAL_HOST for http related entries and DOMAIN_NAME for others. This way you can share you configuration with for example OSX users using dinghy.

Resolve via developer-dns

You need to make sure your host can resolve the docker dns entries. This can be done in many ways, depending on the system you use.


On a system using resolvconf (eg. ubuntu) you can add this nameserver to the head.

# echo "nameserver" > /etc/resolvconf/resolv.conf.d/head

After making changes to resolvconf, you need to trigger a reload:

sudo resolvconf -u


On systems where openresolv is used you can use the file from contrib and place it in /etc/resolvconf.conf.

systemd resolved

On systems using systemd resolved (eg. Ubuntu 17.04) you need to change:

# echo "DNS=" >> /etc/systemd/resolved.conf

Reload resolved service:

$ sudo systemctl restart systemd-resolved.service


You could also add it manually to your network configuration gui like NetworkManager.