Docker: Got permission denied while trying to connect to the Docker

Docker: Got permission denied while trying to connect to the Docker

Views: 35
0 0
Read Time:52 Second

I hit so many times this issue that I’m nearly sure you too! Bookmark this page because in this article we are going to fix the issue with Docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:

I have a freshly installed docker in Ubuntu 20.04 LTS and straight after the installation I run

$ sudo snap install docker
docker 20.10.14 from Canonical✓ installed
brewedbrilliance@my-local-k3s:~$ docker ps
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/containers/json": dial unix /var/run/docker.sock: connect: permission denied

So to fix got permission denied you just need to run these 2 commands

$ sudo groupadd docker
$ sudo usermod -aG docker ${USER}

Reboot your machine (newgrp will not work with ubuntu 20) and login again

$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

Job done!

Help us grow by sharing this article

happy Docker: Got permission denied while trying to connect to the Docker
Happy
0 %
sad Docker: Got permission denied while trying to connect to the Docker
Sad
0 %
excited Docker: Got permission denied while trying to connect to the Docker
Excited
0 %
sleepy Docker: Got permission denied while trying to connect to the Docker
Sleepy
0 %
angry Docker: Got permission denied while trying to connect to the Docker
Angry
0 %
surprise Docker: Got permission denied while trying to connect to the Docker
Surprise
0 %

Share this content:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x