Docker Community Forums

Share and learn in the Docker community.

Sharing port both from container and host?

Hi,
I’m running a rabbitmq-server from host machine, and this server tries to accept connection from both host machine and docker container.
Because docker container was built with option -p 5672:5672 container has no problem to connect to MQ server on host machine.
However, because of that port mapping option, a client on host machine connects to docker container when using port 5672, and it fails.
Is there a way to have both host and container be able to connect to rabbitmq server using the same port?
If it’s not feasible, what’s the best practice in this case?
Thank you!