How to let Docker containers broadcast their IP addresses or hostnames to each other?

One aspect of Docker that has always made me thinking is what’s the appropriate way to let different containers that collectively make up an application’s architecture about each others IPs and host names.

So let’s pretend that we have a Docker deployment topology similar to this:

  • Docker: How to deal with restarted nodes?
  • Docker-compose: Use gelf driver can not resolve host of linked container
  • Failed to send join request to master?
  • docker container interface not being attached to docker0 bridge in coreos
  • zeppelin can't communicate with Cassandra (docker, windows 10 host)
  • Golang Mac OSX build for Docker machine
  • Topology

    Each orange node represents a Container. All the containers might be running on the same physical machine or each container might have its dedicated EC2 instance. It is also possible that all Author nodes reside on one EC2 instance, and all the Publisher nodes on their own EC2 instance.

    But for the sake of this question, we can assume that they are all running on a Developer’s local machine, or each one is running on its own dedicated EC2 instance.

    How can I let all of the instances get IP addresses and/or hostnames of all the other instances as they come and go?

    So when Author 2 dies, Author 1, Author N, as well as Publisher 1,2 and N should be notified of this event. Similarly, when a new Publisher joins the topology, all other instances should be notified of its IP address and/or hostname.

    I am looking for a solution for both my local development environment, as well as one that’s suitable for a production AWS deployment. Ideally, the same solution should work both locally and on AWS.

  • Docker image gives me “executable file not found in $PATH” when run from python
  • Docker Reverse Proxy To Subdomains
  • git ssh can't access to gitlab in a docker container
  • docker-compose build throwing error ERROR: Untar re-exec error: signal: killed: output:
  • Why docker containers can run, despite of docker-machine is not running?
  • Jenkins with docker
  • One Solution collect form web for “How to let Docker containers broadcast their IP addresses or hostnames to each other?”

    ETCd is exactly what you want. AWS doesn’t support any sort of multicast or broadcast traffic on their native network. Etcd which is part of CoreOS gives you a framework for service discovery. It allows you to discover nodes along with registering nodes.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.