canonical / docker-snap

https://snapcraft.io/docker
MIT License
54 stars 27 forks source link

Docker client tries to connect to the wrong socket #143

Closed mastier closed 1 year ago

mastier commented 1 year ago

That is true for both apt package and snap

it should /run/docker.sock instead of /var/run/docker.sock

$ 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

$ ls -la /run/docker.sock srw-rw---- 1 root docker 0 May 26 14:42 /run/docker.sock=

$ snap info docker |grep installed installed: 20.10.24 (2893) 135MB -

$ apt show docker.io Package: docker.io Version: 20.10.21-0ubuntu1~22.04.3 Built-Using: glibc (= 2.35-0ubuntu3), golang-1.18 (= 1.18.1-1ubuntu1.1) Priority: optional Section: universe/admin Origin: Ubuntu

Related LP bug https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/2020890

xnox commented 1 year ago

@lucaskanashiro @sergiodj @panlinux - can you please look into this? indeed /var/run => /run migration has been completed years ago, and things really should use /run directly for like a decade now.

lucaskanashiro commented 1 year ago

The fix for the Debian package is ongoing already. I'm going to do the same for the snap package.

mastier commented 1 year ago

So it seems like a regression. Should be applied ASAP imho.

sergiodj commented 1 year ago

@mastier While I agree that moving the socket to /run would be a good idea, upstream itself is still working on this. Debian-like systems (including Ubuntu) have the required symlink from /var/run to /run, which mitigates this issue meanwhile.

From the logs you posted, your problem seems unrelated to the path where the socket is located. You got a Permission denied error while trying to access the socket, so I'm wondering if you forgot to add your user to the docker group.

lucaskanashiro commented 1 year ago

The fix I was mentioning is in the systemd socket file, this is going to be fixed in the Debian package, but in the snap there is no custom systemd socket file and the upstream one is already using /run. As Sergio mentioned, I do not think this is the issue you are facing.

xnox commented 1 year ago

@mastier what is the output of id ? is the account running docker command part of the docker grou?