Sunday, May 10, 2020

docker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied

Problem:
localuser@ubuntu:~$ 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.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied

Solution:

localuser@ubuntu:~$ sudo su -
root@ubuntu:~# usermod -g docker localuser

localuser@ubuntu:~$ sudo su
root@ubuntu:/home/localuser# chmod 666 /var/run/docker
docker/      docker.pid   docker.sock 
root@ubuntu:/home/localuser# chmod 666 /var/run/docker.sock
root@ubuntu:/home/localuser# exit
exit
localuser@ubuntu:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
localuser@ubuntu:~$

No comments:

Post a Comment