DrT
DrT

Reputation: 31

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

I am trying to connect to a docker image, for that, i tried those commands:

export CR_PAT=<your token access>
echo $CR_PAT | docker login ghcr.io --password-stdin -u <your username>

I used as username my Github username and as result, i got:

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

so to fix it, i tried to give permissions for all users using the following command:

sudo chmod 777 /var/run/docker.sock 

and when i retype

    echo $CR_PAT | docker login ghcr.io --password-stdin -u <your username>

the terminal didn't return any answer!! it's blocked ..

any help please??

Thanks.

Upvotes: 1

Views: 2436

Answers (2)

Niusha Sabahi
Niusha Sabahi

Reputation: 1

You may need to add your user to the docker group with:

sudo usermod -aG docker $USER

If you get an error stating that the docker group doesn't exist, you can create it with:

sudo groupadd docker

Upvotes: 0

DrT
DrT

Reputation: 31

The problem was fixed by restarting the computer.

Upvotes: -1

Related Questions