Docker how to add a user to group docker on Linux

It is a good idea to add a user to docker group. In case user is not added to docker group, you may see the following error msg (even when docker daemon is running):

$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

To fix this error, ether run all docker commands as root or add current user to docker group as shown below:

$ sudo usermod -aG docker user1

After this logout and login again for changes to take effect.

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments