Container Manager on a Synology NAS: Docker Setup Guide

  • Post author:WunderTech
  • Post published:May 28, 2023
  • Post last modified:May 26, 2024
  • Post category:Docker / Synology
  • Reading time:22 mins read

Share what you're reading!

This article will look at Container Manager on a Synology NAS. Container Manager on a Synology NAS is the successor to the Docker package and was recently released with Synology’s DSM 7.2. While it may appear that Docker is gone, for all intents and purposes, Container Manager is the new Docker.

Container Manager on a Synology NAS has the same features that Docker had, but an entirely new user interface that is extremely different than the old and now outdated Docker interface, plus a few new enhancements.

We will look at some of the key features of Container Manager on a Synology NAS below.

Using Docker with Container Manager on a Synology NAS

These are some key features of Container Manager on a Synology NAS.

User Interface for Container Manager on a Synology NAS

You can access Container Manager by using its new icon to launch the application.

Container Manager on a Synology NAS.

When you launch the tool, you’ll be brought to the new user interface. The interface will show various tabs, all of which we’ll go over below.

Container Manager UI.

Project Tab – Docker Compose using Container Manager on a Synology NAS

The Project tab is a new improvement in DSM 7.2 and allows you to create and manage Docker Compose containers.

Container Manager Project Tab.

Speaking transparently, I don’t think that there’s any reason to create a Docker container on a Synology NAS using the Synology GUI anymore.

Docker Compose files have always provided an easier setup process and allow you to maintain the configuration of the container in case you ever need to recreate or move it.

Think of it this way – if you purchase a Proxmox server and want to move all of your Docker containers over to it, Docker Compose will allow you to move the entire container, its data, and start it up by running a single command.

If you don’t use Docker Compose, you’ll be forced to recreate each Container using either Docker Compose, a Docker Run command, or something like Portainer, so this is a pretty significant improvement for portability.

You’ve always been able to use Docker Compose on Synology NAS devices, but you’ve never been able to do it through the Synology GUI. To use Docker Compose, follow the instructions below.

1. Select Create to create a new Project.

2. Give the project a name, select the path where the files should be stored, then either upload or create a Docker compose file.

If you choose to upload the file, it should be a docker-compose.yml in the path specified.

docker compose in container manager.

3. One important thing to remember is that you must use the path that includes the volume number when using Docker Compose.

For example, using the Jellyfin configuration example below, you must set the path for volumes as the correct folder location (/volume1/docker/).

version: '3.5'
services:
  jellyfin:
    image: jellyfin/jellyfin
    container_name: jellyfin
    network_mode: 'host'
    volumes:
      - /volume1/docker/jellyfin/config:/config
      - /volume1/docker/jellyfin/cache:/cache
      - /volume1/docker/jellyfin/media:/media
    restart: 'unless-stopped'

Ironically, there is no Container Manager default folder in DSM, so it’s probably a good idea to continue to use the default docker folder.

Container Tab – Container Manager on a Synology NAS

The Container tab will allow you to create Docker containers the way you always did in prior versions of DSM.

container manager container tab.

While the user interface is slightly different, you can use the GUI to find an image and then create a fully functional Docker container using all of the settings you’ve always been able to.

container creation in container manager.

This step differs greatly depending on the Container you’re trying to configure, but here are a few important notes:

Docker Volume Mappings – Container Manager on a Synology NAS

When creating a Docker container using Container Manager on a Synology NAS, the important data must be mapped to a local folder. This is completed in the Volume section, where a local folder is mapped to a container folder.

volume settings in container manager.

When the container runs, the container’s folder location in the Mount Path below is written to the File/Folder entered on your Synology NAS. Any data that is modified on the local Synology NAS folder will write to the containers folder.

It’s important to highlight that you can’t mount any folders that you’d like. When you download an image from the registry, a little icon (shown below) will bring you to the documentation for that container. You can search that documentation to see what folders can be mounted.

docker synology nas - registry container

After you navigate to the documentation, you will have to search the page to see what volumes can be mounted. Unfortunately, all documentation is different, so you will have to search through it to find the volume information.

Using Pi-Hole as an example, an example Docker Compose file is provided. Under the volumes section, you can find the two volumes that can be mounted.

example of a docker-compose file that can be used to install a container. How to use Docker on a Synology NAS

Using ./etc-pihole/:/etc/pihole/ as an example, pihole is the local folder and /etc/pihole is the container’s folder.

You can easily translate this to a Synology NAS by creating subfolders in the docker folder and mounting that folder location to the container’s folder. Using the screenshot below, I created a folder named pi-hole and a sub-folder name pihole.

Those folders are inside of the docker folder and are mounted to the container’s /etc/pihole folder. When the container is started, the contents of the container’s /etc/pihole folder will be written to my Synology NAS’s pihole folder.

If you are interested in backing up a container, the folders you mount for each container hold all of your personal data. These are the important folders that must be backed up. The rest is simply configuration that can be created on a separate NAS or Docker installation.

volume settings.

Environment Variables for Docker Containers

By default, many Docker containers have environment variables that you can modify to change the settings of the container.

There aren’t standard environment variables across containers and while some share variable names, it’s always suggested to view the documentation and determine which environment variables you’d like to use.

The container will come standard with certain variables, but you have the option of changing them or adding new ones before the container is created.

This is an example of the Pi-Hole environment variable details listed in the documentation.

docker environment variables example

In the Docker container on your Synology NAS, the Environment section is where you can add, remove, or change environment variables.

docker synology nas environment variables

Network Settings for Docker Containers

For most configurations, host or bridge is used for the network. However, there are certain times where you might want to configure a macvlan network interface (like for Pi-hole).

This generally occurs when there is a port conflict (like when a docker container will use 80/443 and the host network interface already uses them). When this occurs, the port conflict will stop the container from functioning properly. In situations like this, you have two main ways of fixing the problem:

1. Change the local port so that you’re using something different.

For example, if the Docker container wants to use port 80, change the Local Port to something different, like 8080 as shown below. To access the Docker Container, you’d then use your Synology NAS’s IP address and the local port.

http://[SYNOLOGY_NAS_IP]:8080
synology nas docker port settings

2. Create a macvlan network interface. A macvlan network interface will avoid all port conflicts as you’re specifying a unique IP address that the container you’re creating will use.

This means that you’ll access that container using a completely different IP address than your Synology NAS. By default, your host (Synology NAS) will not be able to communicate with your container.

For this reason, a bridge network is required so that the host (Synology NAS) and the container can communicate. To be clear, if the Synology NAS needs to communicate with the container, you will use the bridge network IP address and NOT the macvlan IP address.

Create a Macvlan Network Interface

We will look at how to create a Macvlan interface below.

1. SSH into your Synology NAS using your favorite SSH tool.

2. First, we need to determine what network interfaces currently exist (on your Synology NAS) and note down the adapter name. To do this, run the command below and note down the network interface name that has your Synology NAS’s IP address (in this example, mine is eth0).

ifconfig
ip addresses accessible in DSM via ifconfig command

3. Next, you need to run the command below while substituting the correct subnet (most are 192.168.1.0/24 by default). You also need to pick an IP address that you’d like to use that’s not currently in use. I will be using 192.168.1.198.

NOTE: ph_network will be the name of the network (you can substitute this as you’d like).

sudo docker network create -d macvlan -o parent=eth0 --subnet=192.168.1.0/24 --gateway=192.168.1.1 --ip-range=192.168.1.198/32 ph_network
synology nas docker macvlan network interface creation

Our network is now created. We can then exit our SSH session and disable it in DSM (if you won’t be using it). If you are disabling it and created a firewall rule for it, you should inactivate the firewall rule as well.

4. You can then add the network to your Docker container when you create it!

network settings in containers.

Adding Multiple Network Interfaces

If you’d like to add multiple network interfaces to a Container, you must do it from the Network tab in Container Manager.

1. In the Network tab, select Manage under a Network Name.

network tab in container manager.

2. Select the Container you’d like to add the Network Interface to.

adding a network interface.

3. That’s it! The Network Interface will now be part of the Container!

Updating Docker Containers in Container Manager

Over time, you may run into scenarios where a Docker container has an update that you want to install. Container Manager makes this extremely easy.

For reference, we will be updating the Unifi Controller in this example (currently running v6.5.55).

Always make sure you have backups of your important data before updating a Container!

unifi controller showing version v6.5.55.

1. Stop the Container, then open Container Manager and select Image, then select Update Available.

image tab in container manager showing updates available.

2. Select the Update button to update the container.

updating a docker image in container manager.

3. Select Update if you’d like to proceed.

selecting the update button.

4. The container will now update! That’s literally it.

container manager image updating.

5. When it’s finished updating, you will have the latest version!

unifi controller v7.3.83.

How to Access a Container via Command-Line Interface (CLI)

There are certain situations where you will need or want to access the container’s files. Whether you need to modify something (by mounting a file volume) or view the structure, there’s a way to do it on a Synology NAS, but it must be done through SSH.

1. Start your container! If the container is not started, you will not be able to access the container!

2. Ensure you can SSH into your Synology NAS. Open Control Panel, select Terminal & SNMP, and Enable SSH service.

If you are using Synology’s Firewall, ensure that you allow port 22 traffic. I created a video on how to SSH into your Synology NAS if you have any problems.

3. Run the command below to list the running containers. Copy the Container ID.

sudo docker container ls
docker container listing in terminal window

4. Run the command below and substitute the container ID found above.

sudo docker exec -it CONTAINER_ID bash
how to connect to container via terminal

5. You will now be connected as the root user for the container!

how to view container settings

Conclusion: Synology NAS Docker Setup

In general, Container Manager on a Synology NAS isn’t drastically different than it was on DSM 7.1 and below. The user interface is different and the addition of Docker Compose is awesome, but in general, the settings are all there like they used to be…just in entirely different locations.

Container Manager is an upgrade in almost every way, so even though there will be a transition for it with existing tutorials still referencing Docker, in the long run, Container Manager will be a better overall product.

Thanks for checking out the article on Container Manager on a Synology NAS. If you have any questions on Container Manager on a Synology NAS, please leave them in the comments!