DEV Community

loading...

Docker connect: permission denied [Solved] in Linux

try_catch profile image try_catch Updated on ・1 min read

Problem

So you've got your docker up and running but on some day it says

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/images/json:
dial unix /var/run/docker.sock:
connect: permission denied
Enter fullscreen mode Exit fullscreen mode

your user is already in docker group, so

sudo usermod -aG docker $USER
Enter fullscreen mode Exit fullscreen mode

doesn't help

Solution

Bad:

sudo chmod 777 /var/run/docker.sock
Enter fullscreen mode Exit fullscreen mode

Good:

sudo setfacl --modify user:$USER:rw /var/run/docker.sock
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

pic
Editor guide