Docker Community Forums

Share and learn in the Docker community.

ZMQ sample examples not working in dockerized environment!

Hello,

I am trying to dockerize the following data pattern from ZMQ sample example to docker containers

http://zguide.zeromq.org/py:rrclient
http://zguide.zeromq.org/py:rrworker
http://zguide.zeromq.org/py:rrbroker

My docker-compose.yml is pasted here

version: “2”

services:

client:
build: client
command: [“python”, “-u”, “./client.py”]
environment:
CLIENT_URI: tcp://localhost:5559

worker:
build: worker
command: [“python”, “-u”, “./worker.py”]
environment:
WORKER_URI: tcp://localhost:5560

broker:
build: broker
command: [“python”, “-u”, “./broker.py”]
environment:
BROKER_DEALER_URI: tcp://0.0.0.0:5560
BROKER_ROUTER_URI: tcp://0.0.0.0:5559

I also modified respective py files to translate URIs using os.environ.get
Something like

address = os.environ.get(‘CLIENT_URI’)
socket.connect(address)

This sample examples (with client, worker and broker files) works perfectly fine when run as standalone applications (in separate terminals) but when I dockerize it as containers, I simply DO NOT see any output.

The images gets built, containers gets launched without any error, but I DO NOT see the output from print statement (as I see it in standalone mode)

Any help is appreciated.

Thanks,
Sakar