How to run Docker commands without sudo on a Synology NAS
A quick guide to enable sudoless docker commands.
Search for "run docker commands without sudo", and you'll come up with a million results telling you how to do it (see: https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo), but unfortunately none of these will work for Synology's OS.
If you have attempted to follow those tutorials, you'll have quickly realised that tools like usermod
and groupadd
don't actually exist on Synology.
You'd have thought that it works the same way as Synology's base OS is Linux, but nope!
Fortunately, as the base OS is Linux, there is a way to achieve this:
- Create a
docker
user group:sudo synogroup --add docker
- Change the owner group of the
docker.sock
file:sudo chown root:docker /var/run/docker.sock
- Add your user to the new docker group:
sudo synogroup --member docker $USER
- After this, you may need to log out and back in, or even restart your NAS before the permissions take effect.
You should now be able to run docker
commands without sudo
.