0

I have an application in a docker container which is a mqtt-client.

I have installed in host (windows) ActiveMQ-Broker which has an interface of mqtt: 0.0.0.1:1549

(Actually, I can call winwows-PC as super-host. Docker containers are run in WSL2-host (Debian) which is on Windows-Host.

Docker containers are configured with default network settings, e.g. bridged network, without exposing any port.

My mqtt client on docker-container can successfully connect to ActiveMQ broker that runs on host-windows, through Host-IP:1549

My mqtt client on docker-container subscribes to a topic.

Then, I send a message to that topic using ActiveMq admin console:

enter image description here

Unfortunately, my mqtt client on docker-container does not receive that message.

I have run another mqtt client on windows and subscribed to the same topic, to confirm that ActiveMq Broker successfully sends the message to subscribers, and seen that, yes, mqtt client on windows receives the message without problem.

Can the problem happen because docker-container can reach to windows-host, but windows-host cannot write to all ports of docker-container?

I see the connection established in ActiveMQ like this:

enter image description here

Does this mean I should have exposed the port 3718 when doing docker run, in order AciveMq in windows host to send message to docker-container? But supposing, this port changes every time, what would I do?

How can achieve that ActiveMQ broker on Windows-Host send message to subscribers running on docker-container?

Mert Mertce
  • 101
  • 2

1 Answers1

0

The problem was not networking. So, the answer to the quesion is:

If docker-container-client connects to the broker, then broker can send to docker-container-client the message without problem.

The problem was silly: Actually, in low-level, the message was being received, but it was failed to see it in high-level of code.

Mert Mertce
  • 101
  • 2