Reading Time: 4 minutes

Today I am going to help you set up Docker and Portainer on your Synology NAS. I’ll be using the Synology that I recently received.

I am assuming you don’t have anything installed on your Synology other than DSM. Skip the steps you have already done.

Docker

To start, we need to install Docker. Docker is software to run containers. Containers contain self-contained pieces of software. This could be, for example, a database container, or a web service like NetBox.

Docker installation

Installing Docker on your Synology NAS is done using the Package Center.

  1. Open the Package Center
  2. Search for Docker (called Container Manager on DSM 7.2)
  3. Click Install

Depending on your network speed, installation should be fairly quick. Once installed, close the Package Center.

Portainer

Once Docker is installed, the easiest way to continue is by using Portainer, a web interface to manage Docker Containers. While all of this can be done on the console, Portainer makes it easier to explain.

Portainer installation

To start, we need to create a folder for Portainer to store its data.

  1. Open File Station
  2. Select the docker folder on the left side
  3. Click Create -> Create folder
  4. Call the new folder portainer. All lowercase
Creating a portainer folder in File Station

After creating the folder, we are going to run a User-Defined script, this will run once and could be deleted afterward. This way you should not be required to enable SSH on your NAS. Which could be a security issue.

  1. Open the Control Panel
  2. Click on Task Scheduler
  3. Click Create -> Scheduled Task -> User-defined script

A new dialog opens for creating a new task.

  • General Section
    1. Change Task to something meaningful, e.g. Install Portainer.
    2. Change the User to root.
    3. Uncheck the checkbox for Enabled.
  • Schedule Section
    1. Change the radio button to Run on the following date.
    2. Change the drop-down to Do not repeat.
  • Task Settings
    1. (optionally) Check the checkbox for Send run details by email.
    2. Enter your Email address in the Email field
    3. Add the code below in the User-defined script section.
  • Click OK
docker run -d --name=portainer \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /volume1/docker/portainer:/data \
-p 8000:8000 \
-p 9000:9000 \
--restart=always \
portainer/portainer-ce

Once you click on OK, you will get a warning message because you are running this command as root. In this case, it is required to run this command as root and it’s perfectly safe. Never run commands when you don’t feel comfortable or do not know what the command is doing. Click on the Red OK button

Warning message for modifying system configurations

Starting DSM 7.2, you will get a request to enter your password after this. Enter your password and click Submit

Select your task, click Run, and then Yes

Portainer Configuration

After running the task, go to http://ip-of-synology:9000 or use its hostname if it’s in your DNS. Portainer installation should pop up. Enter a username, password and (optionally) uncheck the Allow Collection checkbox and click on Create User

Create portainer user

After creating the user, you will be presented with a quick start. Just click on Get Started to continue

When that page is loaded, click on the pencil to edit the local configuration.

In the Public IP field, add the IP address of your NAS, for example, 192.168.1.2, and click on Update Environment.

Feel free to remove the scheduled task, if you want to.