Skip to content
Advertisement

Python, Mqtt : can publish but can’t receive message on docker

I’m running two dockers : one for the mqtt server using mosquitto the other using flask_mqtt

the flask container is receiving the CONNACK and is sending the subscribe to the broker but never get any SUBACK

however it manages to publish hello word to /home/mytopic (mqtt-explorer proof)

this is quite strange because it works without any problem outside of a docker

here is the docker compose :

JavaScript

the flask dockerfile :

JavaScript

and the main.py

JavaScript

Advertisement

Answer

Maybe one of the containers is missing an exposed port. In doubt, try linking them by adding a links: tag in your compose like this :

JavaScript
Advertisement