permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
Enter fullscreen mode
Exit fullscreen mode
The Docker CLI talks to the Docker daemon through a Unix socket, /var/run/docker.sock . On Linux that socket belongs to root and the docker group:
$ ls -l /var/run/docker.sock srw-rw---- 1 root docker 0 Oct 15 09:12 /var/run/docker.sock
Enter fullscreen mode
Exit fullscreen mode
srw-rw---- is mode 660 : read and write for the owner and the group, nothing for anyone else. If your user isn't in the docker group, the CLI can't connect.
The standard fix
Add yourself to the group:
sudo usermod -aG docker $USER
Enter fullscreen mode
Exit fullscreen mode
Then log out and back in — group membership is read when you log in, so the change doesn't reach existing shells. To use it in the current shell straight away, run newgrp docker .…