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:

  • Accessing docker port from inside docker container
  • File not getting updated when using “docker cp”
  • When deploying a Docker container to AWS, do i need to deploy my own reverse proxy as well?
  • Cloning private git repo in the docker container
  • How to give Dockerfile input parameters from docker run command
  • Bootstrapping docker deamon
  • 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.

  • Cannot shutdown high load docker mysql
  • Running ubuntu containers on ubuntu host - application with gui
  • Docker ELK stack with docker-py
  • Docker :- Creating Databases in Postgresql Docker Container
  • Docker Swarm with TLS: Compose behaves strangely using DOCKER_CERT_PATH
  • Screen within Docker from ssh
  • 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.

    https://github.com/coreos/etcd

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