Add the Current User to a Docker Group

When Docker is installed on a Linux system, most commands require root privileges because they communicate with the Docker daemon (dockerd), which listens on a protected socket. For everyday development and testing, repeatedly using sudo is inconvenient and interrupts the workflow. To streamline this, you can add the Current User to a Docker Group, which allows you to run Docker commands without root access.

Adding your user to the Docker group gives you direct access to the Docker daemon socket. This makes common tasks such as docker run, docker ps, and docker build easier, since you won’t need to type sudo for each command. It is especially useful for developers and DevOps engineers who rely heavily on Docker in daily workflows.

That said, there are important security considerations. Membership in the Docker group provides root-equivalent permissions because Docker can control many aspects of the host system. For this reason, only trusted users should be added to the group. In production or shared environments, you may want to explore alternatives such as Docker rootless mode.

With that in mind, let’s go through the steps to add the current user to the Docker group in Ubuntu

Add the Current User to a Docker Group Step-by-Step Guide

Add the Current User to a Docker Group

Follow this step-by-step guide to add your user to the Docker group on Ubuntu, allowing Docker commands to run smoothly without requiring sudo every time.

Also, Read | Change Your Linux Password: A Beginner’s Guide

Step 1: Check if the Docker Group Exists

Run the following command to check for the Docker group:

getent group docker

If it prints information about the group, it already exists. Otherwise, you will need to create it.

Step 2: Create the Docker Group (if necessary)

If the group does not exist, create it with:

sudo groupadd docker

Step 3: Add Your User to the Group

To add the current user:

sudo usermod -aG docker $USER

Replace $USER with a specific username if you want to add another account.

Step 4: Apply the Group Changes

Log out and log back in for the changes to take effect. Alternatively, you can activate the group immediately with:

newgrp docker

Step 5: Verify the Setup

Test Docker without sudo by running:

docker run hello-world

If the container runs successfully, your user has been added correctly.

Also, Read | CentOS vs Ubuntu – Which One Should You Choose in 2025?

Conclusion

Adding the current user to the Docker group makes working with Docker much more convenient by eliminating the need to run commands with sudo. The process to add the Current User to a Docker Group is simple: check the group, add your user, refresh the session, and verify. Keep in mind that this change grants powerful permissions, so it should only be applied to accounts you trust.


Photo of author
Authored by Roshan Ray
Roshan is a tech blogger and writer with over 6 years of experience in creating in-depth technical articles, documentation, and SEO-focused content. Passionate about making complex topics easy to understand, he blends technical expertise with content strategies that drive visibility and engagement.

Hide Ads for Premium Members by Subscribing
Hide Ads for Premium Members. Hide Ads for Premium Members by clicking on subscribe button.
Subscribe Now