I'm playing with deploying services in a Docker Swarm. I'm having trouble letting a container consistently connect to a container on a different node.
Let's say I'm building a GlusterFS pool; I need to open a terminal in each container and add the gluster daemon to the pool. How do I refer to other containers in the pool? Currently I'm using an IP address, but what if a container dies and is recreated? As far as I know there's no guarantee that the new container will have the same IP address. I could use the embedded DNS server to refer to the other containers, but I can only seem to resolve container names and container IDs to IP addresses, and both of those will change if a container dies and is recreated, so there's no point.
Shouldn't I be able to resolve the hostnames of the other containers to their IP addresses? I assumed it would, but it doesn't.
Are there any solutions to my conundrum? (I get the sense that I might be going about using services all wrong, and that in this case I should manually create a container on each node.)