How to run Docker commands without sudo on a Synology NAS

A quick guide to enable sudoless docker commands.

How to run Docker commands without sudo on a Synology NAS
Photo by Cookie the Pom / Unsplash

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:

  1. Create a docker user group: sudo synogroup --add docker
  2. Change the owner group of the docker.sock file: sudo chown root:docker /var/run/docker.sock
  3. Add your user to the new docker group: sudo synogroup --member docker $USER
  4. 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.