Docker Permission Denied

When we run docker commands like docker run, docker ps, we might get the error similar to below 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.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied

Possible Reason: Post installtion steps might not be done properly.

Solution: Run the below commands to fix the issue.

Immediate Fix:

sudo chmod 666 /var/run/docker.sock

Permanent Fix:

sudo usermod -aG docker $USER

Last updated