How to Fix Docker Permission Denied Issue?

Better Stack Team
Updated on August 1, 2022

If you are struggling with the Docker permission denied error, we have prepared a quick fix for you.

Step 1 - Create a docker group

The first step is you create a docker group if you haven’t done it already. To create a docker group, use the following command:

sudo groupadd docker
Copied!

Step 2 - Add user to the group

The next step is to add your user to the newly created group. To add a user to the docker group, run the following command:

sudo usermod -aG docker $USER
Copied!

Step 3 - Login

Run the following command, or log out and log back in. (If it doesn’t work, try rebooting your system)

newgrp docker
Copied!

Step 4 - Check if docker can be run without root privileges

The next step is to check if the Docker can be run without root privileges. To do that, run the following command:

docker run hello-world
Copied!

You will get a warning that you cannot run this command if the docker requires root privileges, otherwise, the command will be executed.

Step 5 - Reboot your system

Finally, reboot your system for changes to take place.

reboot
Copied!
Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →

Reliability is the
ultimate feature

Delightful observability tools that turn your logs & monitoring into a secret weapon for shipping better software faster.

Explore Better Stack