Some models of Synology NAS allow you to run applications in Docker containers.
Install Docker on your NAS
Follow the instructions on www.smarthomebeginner.com, summarizing:
-
Log in to your Synology NAS web interface, and install the “Docker” package
-
Log in to your Synology NAS using SSH, become root (‘sudo -i’)and run:
root@nas# cd /var/packages/Docker/target/usr/bin root@nas# mv docker-compose docker-compose.ORIG root@nas# curl -L https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-`uname -s`-`uname -m` -o docker-compose root@nas# chmod 755 docker-compose root@nas# docker-compose version Docker Compose version v2.18.1
To check for newer versions, browse to the docker-compose releases page. Then, substitute “v2.18.1” in the ‘curl’ command above with the appropriate version number.
Choose type of networking
Initially, I will not use a reverse proxy. Ports 80 and 443 might be in use by the Diskstation software. I’ve decided to use ports 8080 and 8443 when adding a reverse proxy instead of changing the Synology default configuration.
I will use ‘bridge’ networking which means that the Docker containers share the IP address of the Synology NAS. You must select different port numbers for each application.
Environment
Create an environment file for Docker, similar to this:
~~~
root@nas# cat /volume1/docker/.env
PUID=1000
PGID=1000
TZ="Europe/Amsterdam"
DOCKERDIR="/volume1/docker"
~~~
Getting started with docker-compose
Create a docker-compose.yaml file similar to this (minimal example, just runs the Portainer service on port 9000/tcp):
Test your setup:
~~~
root@nas# cd /volume1/docker
root@nas# source .env
root@nas# docker-compose -f docker-compose.yaml up
~~~