Configuring Docker on Synology NAS (DSM 7.x) | Day in my life

January 5, 2022

Configuring Docker on Synology NAS (DSM 7.x)

I bought Synology NAS DS218+ about a couple of years ago. Since been using it as a transient store for all media files before it uploads to the cloud for permanent storage. I was looking to utilise it more, rather than a glorified cache but memory limitation was a bummer. DS218+ comes with 2GB of built-in memory and is user-upgradable to a max of 10GB by adding a second 8GB DIMM. I came across a blog that suggested unofficial upgrades to bump it up to 16GB but, it required opening up the Synology NAS to bare bones to access the first DIMM slot. I took the plunge, and in hindsight, it was one of the best decisions on hardware upgrades I have done, over the years.

Upgrading DS218+ with loads of RAM allows me to run a host of Docker-based applications. It frees time from administrative tasks and is repeatable, i.e. fewer headaches during upgrades. Here is a quick intro to Docker on Synology NAS. Installing Docker on DSM (DiskStation Manager, Synology NAS GUI) is as easy as clicking a button and gets you going quickly. If the Dockerised application you want to run isn’t conventional, knowing a little deeper might go a long way.

Installing Docker

Docker

Configure docker for non-root user

Docker is installed and run as a root user. If you look at the permissions on the docker.sock you will see it has both user and group of the root.

$ ls -l /var/run/docker.sock 
srw-rw---- 1 root root 0 Jan  5 22:15 /var/run/docker.sock

To make Docker accessible for non-root users through a CLI, you would have to move the docker.sock to a group that’s a bit more permissible. Create a new group and make docker.sock be part of the new group. Restart the Docker service and make non-root user members of the newly created group.

You can achieve group creation either in DSM or SSH. Changing docker.sock group ownership still needs SSH.

# Create a group named docker
$ sudo synogroup --add docker

# Change group ownership of docker.sock to newly created group
$ sudo chown root:docker /var/run/docker.sock

# Make a non-root user member of docker group
$ sudo synogroup --add docker user1 

How I have setup and example use-cases

I have created a separate user account to run all my dockerized applications. That way it won’t mess with all other stuff I have it running on Synology for other purposes mainly photo backups and as NFS. Below is a list of applications that I run and might add a few more moving forward and might write about it here

© Nataraj Basappa 2021