Install the MQTT Mosquitto broker on NAS Synology (DSM 6.2+) with Docker

Table of Contents

It is very easy to install a Mosquitto MQTT broker on a Synology NAS using the Docker application. Since version 6.2 of DSM (DiskStation Manager, the operating system of Synology NAS), the Docker folder structure is different. Synology has developed the Docker application (note, this is not the official Docker application) which allows you to recover images and easily manage containers. It is the easiest method to install, configure, and start containers if you are not used to command lines.

Synology Docker’s app is however limited for advanced settings. You will have to use the Terminal or Powershell to modify the Mosquitto configuration file. This tutorial was made on a Synology DS718+ NAS equipped with 8GB of RAM DDR3.

Synology NAS compatible with Docker

To install Mosquitto in a Docker container, you need a compatible NAS. They are essentially NAS equipped with Intel processors. Here is the list of compatible Synology NAS models. The official list can be found on this page.

Series 19:RS1619xs+, RS1219+, DS2419+, DS1819+, DS1019+

Series 18:FS1018, RS3618xs, RS2818RP+, RS2418RP+, RS2418+, RS818RP+, RS818+, DS3018xs, DS1618+, DS918+, DS718+, DS218+

Series 17:FS3017, FS2017, RS18017xs+, RS4017xs+, RS3617xs+, RS3617RPxs, RS3617xs, DS3617xs, DS1817+, DS1517+

Series 16:RS18016xs+, RS2416RP+, RS2416+, DS916+, DS716+, DS716+II, DS216+, DS216+II

Series 15:RS815RP+, RS815+, RC18015xs+, DS3615xs, DS2415+, DS1815+, DS1515+, DS415+

Series 14:RS3614xs+, RS3614RPxs, RS3614xs, RS2414RP+, RS2414+, RS814RP+, RS814+

Series 13:RS10613xs+, RS3413xs+, DS2413+, DS1813+, DS1513+, DS713+

Series 12:RS3412RPxs, RS3412xs, RS2212RP+, RS2212+, RS812RP+, RS812+, DS3612xs, DS1812+, DS1512+, DS712+, DS412+

Series 11:RS3411RPxs, RS3411xs, RS2211RP+, RS2211+, DS3611xs, DS2411+, DS1511+, DS411+, DS411+II

Series 10:RS810RP+, RS810+, DS1010+, DS710+ (DSM v6+)

Install Synology Docker Manager

The first thing to do is to install the Docker application developed by Synology. Open the Package Center and search for the keyword Docker in the search field. Click on Install.

install docker nas synology dsm 6.2

Install the nano editor

By default, only the standard VI editor is installed. It is a little particular editor to take in hand. Fortunately, the community has developed a package to easily install the nano editor that we know better.

Open the package center and click on Settings.

nas synology dsm 6.2 centre paquet ajouter source

Add the next source and save.

nas synology community source

Open the Community source that has been added to the list and do a search with the keyword nano. Install the package. The Nano editor is available as soon as the package is installed.

nas synology install nano editor dsm 6.2

Configure SSH access

Last thing to do before installing Mosquitto, open the SSH access of the NAS. Open the control panel and activate the advanced mode (in the upper left corner). Open the Terminal & SNMP panel then

Check Enable SSH service

  • Configure the port. By default, SSH uses port 22. To limit the risk of intrusion, you can modify it.
  • Apply the changes. It is not necessary to restart the NAS to take into account the new settings.

nas synology dsm 6.2 activate ssh port

Install the MQTT Mosquitto broker

Launch the Docker application from the DSM menu.

nas synology docker application

Open the Register panel and search for the keyword mosquitto in the search field. Select the official eclipse-mosquitto repository. Start the download by clicking on Download in the options bar.

nas synology docker mosquitto download latest

Choose latest (most recent version) in the dialog box that appears.

nas synology mosquitto latest

All the files necessary for the operation of Mosquitto (dockerfile) are downloaded into the image library. Even if you destroy the container, the image will remain available on disk. This allows for example to test several configurations.

Select eclipse-mosquitto from the list and click on Launch to start the installation of the broker.

nas synology install mosquitto image

You can customize the container name. Then click on advanced settings.

nas synology install docker mosquitto

Check the Activate automatic restart option which will restart Mosquitto in the event of a crash.

nas synology install docker mosquitto autostart

Do not change the network configuration. By default, bridge mode is selected.

nas synology install docker mosquitto reseau

On the Port Settings tab, click the + to add port forwarding. Add a redirection from port 1883 of the NAS to port 1883 of the Mosquitto container. You can also add a redirect to port 9001 if you want to connect to Mosquitto as a web socket.

nas synology install docker mosquitto port 1883 9001

Click on Apply to complete the configuration. In the summary window that appears, check Execute this container when the wizard is finished and then Apply.

 nas synology install docker mosquitto summary

The container starts automatically and the Mosquitto broker is available immediately. Open the Container tab then detail to display the status of the broker.

nas synology mosquitto container status

Modify the configuration of Mosquitto. Open port 9001

In most cases, you shouldn’t need to touch the Mosquitto configuration file. We will however see how to do it. You may need to open port 9001 which allows Websocket connection to Mosquitto.

Connect in SSH to your NAS. Use Powershell or Putty on Windows, the Command Terminal on Linux or macOS.

Once connected, log in as root with the command

sudo su -

Re-enter your password

Find the path to the mosquitto.conf file with the command

find / -name mosquitto.conf

You should get something that looks like this.


You should only open the file located in the folder ending in -init.

Open the configuration file with the command

nano /volume1/@docker/btrfs/subvolumes/e22e9eda6d82a1ec8b772536eb339c611f306af1153f150c2ecb3e1a30922b11/mosquitto/config/mosquitto.conf

Go down the cursor in the Default listener section and add the desired ports. for example

listener 1883
listener 9001

Combination Ctrl + X then Y to save. Re-start the container from DSM to apply the changes. Don’t forget to add a redirect to the new port if necessary.

Tutorials on MQTT for DIY connected objects

Here are other tutorials on MQTT to go further

Click to rate this post!
[Total: 2 Average: 5]

Thanks聽for your reading

Did you like this project ? Don't miss any more projects by subscribing to our weekly newsletter!

Are you having a problem with this topic?

Maybe someone has already found the solution, visit the forum before asking your question
  1. This was very useful. I would be interested to know how you set up security on the installation inside docker.

    Thank you.

    • Thank you very much Jon. I will see if it is possible to do so. I hope to get there, it is a bit beyond my knowledge of docker 馃槄

  2. Thanks for this guide. I followed it on a DS218+ as a beginner to start using Docker and MQTT, however I did not succeed to get the MQTT server up and running.
    Searching for the reason I found that other guides mount volumes.
    Can you please indicate why you shouldn’t mount volumes.

Leave a Reply

Read more
DIY Projects
DIY Projects
%d bloggers like this: