DevOpsDockerDockersHow toUncategorized

Solving – Docker permission denied while trying to connect to the Docker daemon socket

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.39/containers/json: dial unix /var/run/docker.sock: connect: permission denied

Solution:

The error message tells you that your current user can’t access the docker engine, because you’re lacking permissions to access the unix socket to communicate with the engine.

As a temporary solution, you can use sudo to run the failed command as root.
However the docker is recommended to fix the issue by adding the current user to the docker group:

Run this command below in your server console:

$ sudo usermod -a -G docker $USER

After doing that, you should be able to run the command without any issues. Run docker run hello-world as a normal user in order to check if it works. Reboot if the issue still persists.

Logging out and logging back in is required because the group change will not have an effect unless your session is closed.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

91R GClC 7G

Please type the text above:

Check Also

Close
Close
Close