Docker is really great for many purposes, it’s even more valuable for NAS device like Synology. It provides so much more possibilities and expands functionality greatly.
Synology DSM adds a nice web GUI for its docker package so most of the work can be done in UI fashion without even knowing any commands for docker.
That is pretty much the case for me initially, but later I played more with docker it inevitably requires knowledge of few docker commands, not too much though.
get a docker shell as root
this would be useful and no need to get into container with ssh:
docker exec -u 0 -it <container name> bash
copy file from docker to host
Another thing can’t do with web GUI in synology docker package:
docker cp <containerId>:/file/path/within/container /host/path/target
copy file from host to docker
This maybe less often than copy file from docker to host, but still sometimes it might be useful, it’s pretty much same as previous one:
docker cp /host/path/target <containerId>:/file/path/within/container
docker permission issue with volume from synology host
One thing I encountered is when I mount a host directory into docker, I may get the error saying docker can’t read/write it due to permission issue.
The way to solve it is basically to provide extra environment variable
PUID for docker.
PUID being the group/user id for the host directory owner.
In Synology DSM case it’s most likely to be
docker mount volume trap
This is a bit tricky and took me a while to figured out by experiment. Basically if you mount a host directory into a docker path which docker container also have that path, then docker would ONLY recognize the top level and the sub-directory is actually still from docker container itself.
For example when I configure the
ghost container, I mount a host directory
into docker path
/var/lib/ghost. Later it turned out the path
ghost is from docker itself, not my host path
To force docker uses host path, we need to do a second mount by mapping
/var/lib/ghost/content which is a bit surprising to me..