Enhancing Skills

How to Use Docker on Synology NAS Without Sudo

In this article, we will show you how to set up Docker on a Synology NAS without needing the sudo command. We’ll explain what you need to do and provide step-by-step instructions so that you can run Docker containers easily without using sudo.

Table of Contents

Introduction

If you have previously used Docker, you may be familiar with adding your computer’s user account to the Docker group. This allows you to control Docker without needing an extra “sudo” command. However, on Synology NAS devices, this step is not done by default. In this article, we will guide you through the process of setting up Docker on a Synology NAS without using sudo.

Prerequisites

Before you begin, make sure you have the following:

  • A Synology NAS device with Docker installed.
  • Administrative access to your Synology NAS.

Adding User to the Docker Group

  1. Open the “Control Panel” on your Synology NAS.
  2. Click on “Terminal” to open a command-line interface.
  3. Run the following commands:
sudo synogroup --add docker
sudo synogroup --member docker $USER

These commands will add your user account to the Docker group and allow you to run Docker without sudo.

To view the users and groups, use the following commands:

cat /etc/passwd
cat /etc/group

Setting Permissions for the Docker Socket File

  1. Still in the Terminal, run the following command:
sudo chown root:docker /var/run/docker.sock

This command changes the ownership of the /var/run/docker.sock file to the root user and the Docker group, allowing your non-administrative user to interact with Docker.

Testing docker without sudo

Restart your terminal session.

Type the following command:

docker ps

Conclusion

Now that you have followed these steps, you should be able to run Docker on your Synology NAS without needing the sudo command. Enjoy using Docker in a more accessible way, and don’t hesitate to explore other features of your Synology NAS device!

Reference

https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_Administration_CLI_Guide.pdf


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.