FIXED: Docker permission denied

FIXED: Docker permission denied

FIXED: Docker permission denied

Docker Oct 15, 2022

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

Platform:
Docker

Reason:
When we run docker as non-root user

Solutions:
1. We need to add our current user to the docker group. please follow steps to resolve the issue.

(i). We need to create the docker group if it does not exist.

sudo groupadd docker

(ii). Add our user to the docker group

sudo usermod -aG docker $USER

(iii). Log in to the new docker group.

newgrp docker

(iv). Check if docker can be run without root

docker run hello-world

(v). Reboot if still got error

reboot

Now it will work.

2. Second solution is to give requiredpermission to the user.

sudo chmod 666 /var/run/docker.sock


Thanks!

Tags

Anurag Deep

Logical by Mind, Creative by Heart