Run docker commands without sudo :))

azibom

Mohammad Reza

Posted on July 10, 2020

Run docker commands without sudo :))

First create a docker group

sudo groupadd docker
Enter fullscreen mode Exit fullscreen mode

Add the connected user $USER to the docker group

sudo gpasswd -a $USER docker
Enter fullscreen mode Exit fullscreen mode

Done

Log out and log back in so that your group membership is re-evaluated.

If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take effect.

On a desktop Linux environment such as X Windows, log out of your session completely and then log back in.

On Linux, you can also run the following command to activate the changes to groups:

 newgrp docker 
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
azibom
Mohammad Reza

Posted on July 10, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related