Welcome to our Knowledge Base

Installing Docker on Synology NAS

You are here:
< Back

1. Installing Docker on the Synology DSM

To install Docker on Synology DSM open the Package Center -> Search for Docker-> Action -> Install 

When installation completes you should see docker in the main menu 

2. Configure Docker root data folder for applications using file manager

Now after installing Docker we should configure a root data folder for the applications data (shared-storage volume), to do this we need to connect to the DSM using SSH and elevate our session to root privileges (sudo su), this requires you have admin/root access with your account.

3. Create Docker Container

There is two ways of creating a Docker containers on Synology DSM, I will show both in detail but below is the differences.

  1. Install containers using Registry through the Docker application in Synology GUI. Configure the containers through the Synology GUI by adding volumes, ports and environment details manually on each container.
  2. Install containers using docker-compose.yml files which holds the full configuration of the Docker container. Its very easy to use docker-compose.yml when the file is ready, but it can be difficult to create (docker-compose.yml files dosn’t handle tabs, only spaces – this is one of the core reasons for syntax errors – personal experience ;))

MQTT Setup

1. Enable Admin login for Synology
2. Enable SSH in NAS
3. Download putty and connect to NAS Server
4. Login using admin
5. change to root user [sudo -i, {use admin password}]
6. find mosquitto.conf file [find / -name mosquitto.conf]
7. go to that path using cd [in my case cd /volume1/@appstore/mosquitto/var]
8. edit mosquitto.conf [vi mosquitto.conf]
9. Might say it’s used by another process. Force edit.
10. Scroll down and find # allow_anonymous [around line 513]
11. Remove # and make [allow_anonymous false] [Use insert on keyboard to edit]
12. Scroll and find #password_file [around line 555]
13. Remove # and make password_file /volume1/@appstore/mosquitto/var/password_file [where 2nd password_file is the actual filename]
14. Save the file [Esc-> :wq to save]
15. Now create a file password_file in /volume1/@appstore/mosquitto/var/
16. ensure your are still in same directory, type vi password_file
17. This will create new file, press insert and type your usernacme and password in below format
18. username:password [Username should not contain :]. You can add multiple users line by line
19. save file and clseo [Esc->:wq]
20. Find mosquitto_passwd [find / -name mosquitto_passwd]
21. Stay in the mosquitto.conf folder itself. Because we have password_file file here.
22. From mosquitto.conf folder, type mosquitto_passwd [along with path] -U password_file to encrypt password.
23. In my case /volume1/@appstore/mosquitto/bin/mosquitto_passwd -U password_file
24. Start/restart Mosquitto Server

25. All done. Thank You.

References

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Table of Contents