# Mosquito in docker on Synology - external access

**URL:** <https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415>\
**Category:** Deployment\
**Created:** [December 19, 2021, 11:20pm UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415 "2021-12-19T23:20:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![chela](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@chela](https://forum.cedalo.com/u/chela)\
**Post date:** [December 19, 2021, 11:20pm UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/1 "2021-12-19T23:20:09Z")

</div>

I am new to Mosquitto,

How do I access Mosquitto Broker that is running in Docker on a Synology NAS.

I need to find / enable external address of the Broker so my Particle Boron can communicate with the Broker.

Your help would be greatly appreciated.

Thank you

---

<div class="post-metadata">

**Author:** ![roger.light](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@roger.light](https://forum.cedalo.com/u/roger.light)\
**Post date:** [January 11, 2022, 10:04am UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/2 "2022-01-11T10:04:38Z")

</div>

Hi chela,

Sorry for the delay replying!

There are two things you need to consider from the Mosquitto side when running on Docker. First off, you need to configure one or more ports that Mosquitto will listen on. You do this in your configuration file. Here are some examples, there are more details on the configuration file at [mosquitto.conf man page | Eclipse Mosquitto](https://mosquitto.org/man/mosquitto-conf-5.html) and

```auto
# Listener with no encryption and no authentication/access control
listener 1883
allow_anonymous true

```

```auto
# Listener with no encryption, with password and acl file access
# See https://mosquitto.org/man/mosquitto_passwd-1.html for info on password files
listener 1883
password_file /mosquitto/config/mosquitto.passwd
acl_file /mosquitto/config/mosquitto.acl

```

```auto
# Listener with no encryption, with dynamic security plugin
listener 1883
plugin /usr/lib/mosquitto_dynamic_security.so
plugin_opt_config_file /mosquitto/data/mosquitto-dynsec.json

```

```auto
# Listener with encryption, with dynamic security plugin
# See https://mosquitto.org/documentation/dynamic-security/
listener 8883
certfile /mosquitto/data/server.crt
keyfile /mosquitto/data/server.key
plugin /usr/lib/mosquitto_dynamic_security.so
plugin_opt_config_file /mosquitto/data/mosquitto-dynsec.json

```

Once you have your configuration file, it needs to be provided to your container. I would suggest using a local directory structure like this for your container data:

```auto
mosquitto/
mosquitto/config/
mosquitto/config/mosquitto.conf
mosquitto/data/

```

The second step is that you need to provide access to the port used in the container. If you’re running docker directly it would look like this, assuming you’re using one of the port 1883 options and following the above local directory structure:

```auto
docker run -it -v mosquitto/config:/mosquitto/config -v mosquitto/data:/mosquitto/data -p 1883:1883 eclipse-mosquitto:2

```

That gives you a running Mosquitto instance listening on port 1883/8883 of the NAS external interface. The next step is to find the external IP address of your NAS and connect to it - doing that is down to you.

I hope that helps.

Regards,

Roger

---

<div class="post-metadata">

**Author:** ![chela](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@chela](https://forum.cedalo.com/u/chela)\
**Post date:** [January 11, 2022, 11:59am UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/3 "2022-01-11T11:59:06Z")

</div>

Hi Roger,

Thank you so much for your help, you are a life saver, I greatly appreciate it.

Thank you

Chela

---

<div class="post-metadata">

**Author:** ![iotrainmaker](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@iotrainmaker](https://forum.cedalo.com/u/iotrainmaker)\
**Post date:** [January 11, 2022, 1:29pm UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/4 "2022-01-11T13:29:58Z")

</div>

@chela, Do you have a fixed IP for your NAS or do you need further help there?

---

<div class="post-metadata">

**Author:** ![chela](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@chela](https://forum.cedalo.com/u/chela)\
**Post date:** [January 11, 2022, 1:38pm UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/5 "2022-01-11T13:38:10Z")

</div>

Hi iotrainmaker,

Yes I have a fixed IP address for my NAS which is an internal address, I have an external address for my internet connection but I’m not sure what I use as an address when trying to access the NAS externally ie to access the Mosquitto broker which is running in Docker - where do I find the address that will get me through to the broker ?

I hope that makes sense.

---

<div class="post-metadata">

**Author:** ![iotrainmaker](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@iotrainmaker](https://forum.cedalo.com/u/iotrainmaker)\
**Post date:** [January 11, 2022, 2:52pm UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/6 "2022-01-11T14:52:31Z")

</div>

in this case you have to set something in your router up that your internal device gets linked to an externally reachable IP and port. If your external IP is dynamic then you can look at [https://www.noip.com/free](https://www.noip.com/free), this is a free service to link a URL from them to your dynamic IP. I haven’t tried it out yet, but @Tizian recently forwarded me that interesting tutorial where somebody makes a raspberry pi externally available: [HOW TO CONNECT A RASPBERRY PI WEB SERVER TO THE INTERNET: Host a website | Raspberry Pi Projects - YouTube](https://www.youtube.com/watch?v=OQcz23NW6VE)  
Again disclaimer: I did not try it yet and all stuff where you make an IP/port externally available you have to be careful that you do not create an IT sec vulnerability.  
Good luck 🙂 Let us know if you got it running finally and how you did it …

---

<div class="post-metadata">

**Author:** ![chela](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@chela](https://forum.cedalo.com/u/chela)\
**Post date:** [January 12, 2022, 9:29am UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/7 "2022-01-12T09:29:05Z")

</div>

Thanks iotrainmaker,

I will let you know how I go, I appreciate your help.

---

<div class="post-metadata">

**Author:** ![iotrainmaker](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@iotrainmaker](https://forum.cedalo.com/u/iotrainmaker)\
**Post date:** [January 26, 2022, 8:41am UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/8 "2022-01-26T08:41:53Z")

</div>

@chela : And, how did it go?  
I just read an interesting article of a guy using cloudflare ([https://itnext.io/using-cloudflare-tunnels-to-securely-expose-kubernetes-services-26713fb5da0a](https://itnext.io/using-cloudflare-tunnels-to-securely-expose-kubernetes-services-26713fb5da0a)) to expose privately hosted services. This goes one step further than using [noip.com](http://noip.com). I did not try it, but cloudflare has a $0 plan for non-business use, so it could be really worth a try.

---

<div class="post-metadata">

**Author:** ![chela](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@chela](https://forum.cedalo.com/u/chela)\
**Post date:** [January 26, 2022, 6:31pm UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/9 "2022-01-26T18:31:47Z")

</div>

Hi Iotrainmaker,

Thank you for following up.

I had to travel for my work just after I received your previous message and I am currently away from home.

I expect to return in the next week or so and thus be able to continue with my project, I hope to provide an update shortly after.

Thanks again 🙂

---

<div class="post-metadata">

**Author:** ![Grilli303](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@Grilli303](https://forum.cedalo.com/u/Grilli303)\
**Post date:** [September 30, 2025, 9:53am UTC](https://forum.cedalo.com/t/mosquito-in-docker-on-synology-external-access/415/10 "2025-09-30T09:53:30Z")

</div>

Dear forum users,

I’m new here and have a similar question to this one, but my configuration is not the same.  
On my Raspberry Pi I have installed Mosquitto MQTT v5.0/v3.1.1/v3.1 and Node-RED.  
MQTT does not run in Docker.  
Now I would like to set up external mqtt access via a Cloudfrare tunnel using websocket.  
My Cloudflare tunnel is already set up so far and I have a own domain.  
Should I ask my question here, or better create a new topic?

Kind regards, Daniel
