I bought a Synology NAS DS218+ about a couple of years ago. Since I’ve 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 made 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, resulting in fewer headaches during upgrades. Here is a quick introduction 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
- Log in to DSM, go to Package Centre, and search for
Docker
and click install. Wait for a few minutes, and once Docker is installed, you will seeDocker
in the Main Menu
- A Docker installation creates a shared folder docker in the default volume. You can move the shared folder to another volume by stopping the Docker service, editing the
Shared Folder
fromControl Panel
, and changing the Location to match the new volume. - You can’t delete the shared folder as DSM complains about being used by the Docker application. Even if you edit the storage location in the Docker config file
/var/packages/Docker/etc/dockerd.json
, you can’t delete the shared folder. The best option is to stick with it. - Docker service runs under the root user irrespective of the user who installed it from the
Package Centre
. - If you manage Docker from DSM, then you are all set. If you want to access Docker from the command line, you need a little more configuration, assuming a non-root login.
Configure Docker for a 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 the 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
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 the newly created group
$ sudo chown root:docker /var/run/docker.sock
# Make a non-root user a member of the Docker group
$ sudo synogroup --member docker user1
How I have set up an example use case
I have created a separate user account to run all my Dockerised applications. That way it won’t mess with all the other stuff I have running on Synology for other purposes, mainly photo backups, and as NFS. Below is a list of applications that I run, and I might add a few more moving forward, and might write about it here.