Permission denied while trying to connect to the Docker daemon socket

Subscribe to our newsletter

If you come across this error, you should fix it by:

  • Checking the permissions on the socket file and to do that run:
  • The above code will output something like the code shown below, where in this case the owner of the /var/run/docker.sock socket is root and the group is docker
  • Once you now know the owner of the socket and the group, you run:

Replace root with the name of the owner in your /var/run/docker.sock socket and group with the name of your group

Voila! That's it!