Running docker without sudo

Why I am using docker requires a special post altogether, but here is quick trick running docker without “sudo”. Docker actually uses /var/run/docker.sock to communicate (to whom?, no idea so far) and it should belong the “dockerroot” group. So here are the steps to get you started with running docker without sudo.

# Make sure the current user belongs to dockerroot group. If not, add it
$ sudo usermod -aG docker ${USER}

# Above step will require the re-login (just spawning a new terminal does
# not help). Now make sure the current user belongs to dockerroot
$ groups | grep docker


# Check the group permission for /var/run/docker.sock, and change it if
# required.
$ ls -l /var/run/docker.sock
srw-rw----. 1 root root 0 Sep  2 10:29 /var/run/docker.sock

# Sigh, change the group to dockerroot
$ sudo chgrp docker /var/run/docker.sock

This should get you started. Steps compiled from here.

Edit:

Latest docker installation in Fedora 24 changes the docker group to “docker” instead of “dockerroot”. Easy way to identify the docker group is to cat /etc/group | grep docker.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s