Docker Community Forums

Share and learn in the Docker community.

[1.12] Docker Service DNS, Resolve Specific Container Instance


(Andrew Munsell) #1

I have a Docker 1.12 service running on 3 different nodes, composed of RethinkDB containers. I want to automatically be able to have the RethinkDB containers discover each other.

One way to do this would be to have the “join” address for all nodes point to container 1’s IP. Node 1 would try and connect to itself and ignore the join address, while the rest would be able to join the cluster and automatically discover the rest of the nodes.

But, is there a DNS name that resolves to a specific container in the service? I don’t want to just use the service name (e.g. “rethinkdb”) because the load balancing could theoretically segment the cluster into separate partitions, depending on which IP was resolved on each container.

I believe you can resolve the other containers with their names, but these contain IDs in them, meaning you can’t determine them beforehand (when launching the service for the first time) as far as I know.