Few lines put together as a reminder on how to set up dns together with etcd in container(s). I will be using skydns and etcd in two separate containers. This is very simple single host docker setup. For more information on skydns and etcd see github:

  1. https://github.com/skynetservices/skydns
  2. https://github.com/coreos/etcd

Getting dns up and running

As mentioned above, the setup is pretty basic. I will be running docker on host with IP, docker bridge is on, and my domain will be *.deki.local

Start up by running etcd with something like this:

HostIP="" docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs \ -p 4001:4001 \ -p 2380:2380 \ -p 2379:2379 \ --name etcd quay.io/coreos/etcd \ -name etcd0 -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \ -listen-client-urls, \ -initial-advertise-peer-urls http://${HostIP}:2380 \ -listen-peer-urls \ -initial-cluster-token etcd-cluster-1 \ -initial-cluster etcd0=http://${HostIP}:2380 \ -initial-cluster-state new  

At this point we can set up configuration for skydock2 using something like:

curl -XPUT \  
-d value='{
"dns_addr":"", \
"pathprefix":"skydns", \
"round_robin":true, \
"domain":"deki.local.", \
"hostmaster":"hm@deki.local", \
"ttl":3600, \
"nameservers": ["",""] \

and start skydock2:

docker run -d -p \  
docker.io/skynetservices/skydns \  
-machines='' \

When containers are up and running we can try and create some dns entries:

curl -XPUT \  
-d value='{"host":"","port":8080}'

and test to see it does work:

dig @ db1.db1-service.deki.local  

Next stop, get skydock running, creating dns entries for containers as they start, and remove them when they exit (or end up killed).