I am building a gossip algorithm, that should make thousands of nodes communicate with each other (let’s call them containers, to disambiguate). I’m thinking of using docker swarm mode and an overlay network, since it will do a lot of cumbersome work on my behalf.
I need to provide my containers with IPs of existing containers to bootstrap my gossip algorithm. Say they are started sequentially, so the first node has no parameter IP, the second has the IP of the first one, the third has the IP of container #1 and #2, and so on.
Until then, I was passing these IPs as command line parameters, but it won’t be possible anymore using docker swarm services. I was thinking of using an external repository to store and retrieve IPs for the containers, but it seems dumb, since docker already ships one, and it seems to know the IP of anyone in the system, given the right command. I saw there that I could get all the IPs from a container using
dig, for instance.
My question is: can I use a Docker Remote API (like Go’s docker/client) to retrieve IPs of containers participating in a service, from inside a container?
Apart from that, thanks for all your work, Docker is really quite awesome.