Docker 1.12
Problem: I am trying to dockerize distributed database - create a cluster using multi-host. The node clusters communicate to each other using IP address/hostnames (application that is dockerized uses zookeeper internally) and has to be provided during startup time.
On single host, in docker environment, I can create cluster by simply assigning names (–name) to each container and pass in the container names (as they are known) as environment variable to container with “docker run”. This is pretty simple and works great.
I want to replicate same thing where the docker tasks can run on different machines and communicate to each other using the hostnames or IP assigned. For the same I have looked at cluster creationg using Docker Engine’s swarm introduced in 1.12. Spinning up a cluster in 1.12 is really simple though one thing I was not able to figure out was if I can associate a name to a task during “docker service create” - assign name to docker instance created by service that starts running in swarm and not the swarm node? If so, how?
Thanks in advance