Docker registrator's normally only register the address entries in DNS only when a container publishes a port, this won't work well when you have an overlay network and do not want to always use export. In the overlay network, each container will get its own ip address, in a multi-nodes cluster, the IP addresses containers get can not be predicted. It is very important when containers come up and die down, the IP entries can be quiered and containers can be accessed by names. This registrator allows just that. When a new container is created, its name will be automatically recorded in etcd. This image will work the best with skydns which hooks up with etcd. In a multi node environment, each docker node should run one instance of this docker container.
Use the following command to start the container:
docker run -d --name registrator -v /var/run/docker.sock:/tmp/docker.sock email4tong/registrator:v10 -internal -ttl 30 -ttl-refresh 20 -resync 18 skydns2://<<IP address of etcd server>>:2379/.
if a docker container has a name like this name1.name2.name3, a dns entry of name3.name2.name1 will be created.
This way, when you create containers, you can use names to distingush container from container. And you can also use container name to access these containers rather than using IP addresses.