I have added myself to the docker group using command sudo usermod -aG docker yashar
. and here is the output of groups yashar
:
yashar : yashar adm cdrom sudo dip plugdev lpadmin sambashare docker
and here is the output of ls -lah /var/run/docker.sock
:
srw-rw---- 1 root docker 0 Apr 8 11:16 /var/run/docker.sock
but when I run docker run hello-world
I get this error:
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
But running sudo docker run hello-world
works without any problems.
Is there anything I'm missing? How can I solve this? I'm using ubuntu 18.04
groups yashar
is showing the correct groupsgroups
may not. I had to completely reboot for it to take effect, re-logging was not enough. Unfortunately, I have no idea why that is the case and I have no answer to my question so far, so I cannot give a better answer than "reboot". https://askubuntu.com/questions/1034463/why-didnt-my-user-get-assigned-to-the-group-i-had-added-myself-to – Dan Apr 09 '19 at 15:00docker
group, you would need to log out and log back in for those changes to effect your current session. Rebooting is somewhat heavy-handed but it does accomplish the log out/log in sequence. – larsks Apr 09 '19 at 15:17