Docker Community Forums

Share and learn in the Docker community.

Connect mqtt container broker from another container using localhost

Hello,

I have two docker containers running on the same machine as docker daemon. one is eclipse-mosquitto(mqtt broker) docker container which is listening to its default port 1883. The mqtt client is running inside another container from where i want to connect mqtt broker using tcp://localhost:1883. This is working if both the containers are running on host network. Since, we have many containers which run mqtt client, i dont want to run them all on host network. Is there any other way to connect client-broker from containers? if yes, please guide.

Thank you!