Skip to content

Latest commit

 

History

History
executable file
·
53 lines (34 loc) · 1.27 KB

05-Using-Docker-without-Root-permissions.md

File metadata and controls

executable file
·
53 lines (34 loc) · 1.27 KB

Using Docker without Root Permission

By default, the Docker daemon will reject requests from users that aren't part of the docker group. If you encounter this message in your travels, you can either use root permission or add your user to the docker group.

docker info 
ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info": dial unix /var/run/docker.sock: connect: permission denied 

Verify the docker group exists by searching for it in the groups file:

grep docker /etc/group

Add the group if it doesn't exist.

sudo groupadd docker

Add your user to the docker group.

sudo gpasswd -a $USER docker

You can login again to have your groups updated by entering:

newgrp docker 

It is convenient to not have to terminate your current ssh session by using newgrp, but terminating the ssh session and logging in again will work just as well. In some instances, you may need to restart the Docker daemon by entering:

sudo systemctl restart docker.

Now try to run docker commands without issuing sudo:

docker info 

Back to first page