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

In this article, we will solution for 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.24/images/json": dial unix /var/run/docker.sock: connect: permission denied

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

Solution for above error is:

We have to add user to docker group by using below command.

Replace User_name with actual user.

sudo usermod -aG docker User_name

Examples:

sudo usermod -aG docker r2schools

To apply the new group membership, log out of the server and back in, or type the following:

su - ${USER}

You will be prompted to enter your user’s password to continue. Confirm that your user is now added to the docker group by typing:

id -nG

Leave a Reply

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