Docker containers communication

I’m striving to achieve the following :

  • have multiple docker containers that perform some period tasks
  • have a component running on the localhost that besides other tasks manages
    (starts/stops) the containers
  • from time to time the services running
    within the containers need to publish the result. Therefore they bind
    to an exposed port using ZMQ and send the result.
  • the component running on localhost subscribes to a specific port and listens on
    that.

The problem is that every container requires a specific/different port on the localhost network to bind to and publish the results. And this implies that I need to listen on all container ports.

  • How to connect a running container(tomcat) on amazon ec2 to RDS postgres
  • No response from Docker container during load test
  • Docker Registrator: Connection refused
  • mounting local home directory in Rstudio docker?
  • Is there an easy way to change to a non-root user in Bitbucket Pipelines Docker container?
  • Why when I switch to a different user environment variable is lost?
  • Is it possible to listen to a single port and all containers publish their work there ?

    If not , what would the options be ?

    Thanks

  • Docker error connecting to host mysql
  • Docker container link for mysql to redmine fails with timeout “waiting for database server to accept connections”
  • Phalcon-compose & Docker Toolbox web-server sees no files
  • Is there any way to install Docker Tooling Kit in mars on Windows
  • What is the difference between docker-compose ports vs expose
  • Docker for Windows: cannot assign requested address
  • 2 Solutions collect form web for “Docker containers communication”

    Try to use ZMQ in container so, containers would publish work to zmq_container and from localhost you will be able to subscribe channel of zmq_contaniner as well (using one port)

    Options:

    1. Publish results to central shared database (like mysql or mongodb container) from all and read from there
    2. Publish results to central shared message queues (like kafka container) from all and read from there. (kafka would be more powerful solution for reliable and real-time message exchange)
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.