Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

Is it possible to listen to a single port and all containers publish their work there ?

If not , what would the options be ?

Thanks

like image 259
steve Avatar asked Mar 09 '23 09:03

steve


1 Answers

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)

like image 102
itiic Avatar answered Mar 16 '23 19:03

itiic