Connect container to desktop application. but the port is already used

hey guys,
i have a mqtt server running on port 1883 on my windows 10 pc (wihout a container).
On the same pc i want to start a container. That container has a mqtt client. This client should connect to the 1883 port.
But docker says:
" Bind for failed: port is already allocated."

docker run --name mqtt -p 1883:1883 mqtt

cheers paua

If your container has a client, you should not use -p at all. Instead, the client in the container should connect to the host’s ip address on port 1833.

1 Like