# Help - Docker - Can't connect to MQTT

**URL:** <https://discourse.nodered.org/t/help-docker-cant-connect-to-mqtt/79489>\
**Category:** General\
**Tags:** docker, mqtt\
**Created:** [29 June 2023 15:27 UTC](https://discourse.nodered.org/t/help-docker-cant-connect-to-mqtt/79489 "2023-06-29T15:27:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![spyder0552](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/spyder0552/32/14035_2.png) [@spyder0552](https://discourse.nodered.org/u/spyder0552)\
**Post date:** [29 June 2023 15:27 UTC](https://discourse.nodered.org/t/help-docker-cant-connect-to-mqtt/79489/1 "2023-06-29T15:27:57Z")

</div>

New to Docker and need some help.  
I have a PUBLIC mqtt server that I know works as I have numerous devices connected to it.

I just created a docker container following the setup instructions in this fourm/site.

I add in a MQTT In, setup the server (enter my public IP and port), use the # wildcard to read all topics and the node just sits there saying connecting.

On my Public system, I can sit on the firewall and see my public IP coming in and the firewall moving the traffic to my broker.

What have I done wrong?

Notes:  
Public Broker is a linux machine behind a firewall that I know works.

My docker image is running on a virtual computer hosted on my laptop.

Thanks

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [29 June 2023 16:00 UTC](https://discourse.nodered.org/t/help-docker-cant-connect-to-mqtt/79489/2 "2023-06-29T16:00:28Z")

</div>

> [@spyder0552](#):
>
> I add in a MQTT In, setup the server (enter my public IP and port), use the # wildcard to read all topics and the node just sits there saying connecting.

Have you maybe set the # at the start of the topic and there are thousands of topics on the server?

---

<div class="post-metadata">

**Author:** ![spyder0552](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/spyder0552/32/14035_2.png) [@spyder0552](https://discourse.nodered.org/u/spyder0552)\
**Post date:** [29 June 2023 16:34 UTC](https://discourse.nodered.org/t/help-docker-cant-connect-to-mqtt/79489/3 "2023-06-29T16:34:14Z")

</div>

Thanks for the reply.  
I know that is not the issue as I have other Linux servers with Node-Red installed directly on it and they don't have an issue. It is something to do with the docker not getting the data back.  
I can see from the firewall and the server running MQTT that a connection is being seen.

I am thinking it is a networking thing with Docker in that the packets are just not getting back in. But I am at a loss when it comes to Dockers.

---

<div class="post-metadata">

**Author:** ![rrabbit454](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rrabbit454/32/74694_2.png) [@rrabbit454](https://discourse.nodered.org/u/rrabbit454)\
**Post date:** [17 July 2023 00:49 UTC](https://discourse.nodered.org/t/help-docker-cant-connect-to-mqtt/79489/4 "2023-07-17T00:49:08Z")

</div>

Hi.  
Do You have TLS connection enable?  
If Yes then watch this (min 20):

[![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/7/b7e2b9541bd6e5df2ce1f9715396e744216dcce2.jpeg "How to install and configure Mosquitto TLS/SSL on lokal device. MQTT Mosquitto Broker part 3.") ](https://www.youtube.com/watch?v=bgbBD5gaxHQ)

Make sure all you'r MQTT client settings are correct.  
I dont think the docker networking it's the problem, it's the client.  
If you haven't got TLS on that broker then i will recommend to do it ASAP!  
Regards.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 September 2023 00:49 UTC](https://discourse.nodered.org/t/help-docker-cant-connect-to-mqtt/79489/5 "2023-09-15T00:49:40Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
