How to allow non root users to run docker commands without using sudo

Although the docker daemon runs as root, it is sometimes useful to grant non root user to run docker commands without the need to use sudo each time. To achieve this add the current user to the docker group. Run the below commands

sudo groupadd docker
sudo usermod -aG docker $USER
# to refresh the group settings
newgrp docker
docker ps

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.