Skip to content

docker

Got permission denied while trying to connect to the Docker daemon socket

got permission denied while trying to connect to the docker daemon socket post logo

This guide will show you how to fix the error Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock when trying to run docker commands.

The Docker daemon binds to a Unix socket instead of a TCP port, but only root users can access this socket by default, hence, when you run docker commands without sudo, you will get the error below:

~ $ docker run hello-world

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.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
Read More »Got permission denied while trying to connect to the Docker daemon socket