# Dockerized node-red

**URL:** <https://discourse.nodered.org/t/dockerized-node-red/13597>\
**Category:** General\
**Created:** [23 July 2019 10:07 UTC](https://discourse.nodered.org/t/dockerized-node-red/13597 "2019-07-23T10:07:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![braous](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@braous](https://discourse.nodered.org/u/braous)\
**Post date:** [23 July 2019 10:07 UTC](https://discourse.nodered.org/t/dockerized-node-red/13597/1 "2019-07-23T10:07:55Z")

</div>

Hi,

I have created a new node where it connects to Mosquitto (local MQTT broker) on port 1883. Everything is fine with node-red running outside the docker, but a dockerized node-red, will not able to establish the MQTT connection.

The first idea is to export the port -p 1883:1883, but it fails and returns the port is already in use.(sudo service mosquitto start)

The second idea is to run mosquitto as a container and establish the link between both, but it reports also. the MQTT connection is not established.  
1/ sudo service mosquitto stop  
2/ docker run -it -p 1883:1883 -p 9001:9001 --name mosquitto eclipse-mosquitto  
3/ docker run -it -u root -p 1880:1880 -v ~/docker/nodered:/data --link mosquitto:broker --name myName image-based-on-node-red:1

Thanks for any help.

Any help

---

<div class="post-metadata">

**Author:** ![michaelblight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/michaelblight/32/445_2.png) [@michaelblight](https://discourse.nodered.org/u/michaelblight)\
**Post date:** [25 July 2019 04:11 UTC](https://discourse.nodered.org/t/dockerized-node-red/13597/2 "2019-07-25T04:11:27Z")

</div>

That's fundamentally how I have it configured. How are you defining the Mosquitto connection from NR?

---

<div class="post-metadata">

**Author:** ![braous](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@braous](https://discourse.nodered.org/u/braous)\
**Post date:** [25 July 2019 06:12 UTC](https://discourse.nodered.org/t/dockerized-node-red/13597/3 "2019-07-25T06:12:44Z")

</div>

I have found the root cause,  
The URL of MQTT in was 127.0.0.1, which works fine for non dockerized NR. But I need to set that URL to 172.17.0.1 for NR container.
