docker.el icon indicating copy to clipboard operation
docker.el copied to clipboard

Permission denied when performing certain operations with docker-run-as-root

Open lunik1 opened this issue 3 years ago • 1 comments

When performing certain operations I get errors such as

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

these are usually operations that involve "stepping inside" the container - e.g. finding a file or opening a shell. I can perform operations such as restarting, stopping, and viewing the logs of containers just fine.

I am using docker-run-as-root. In my environment I cannot add myself to the docker group due to the security implications.

I am using Doom emacs @ emacs 27.

lunik1 avatar Apr 24 '21 14:04 lunik1

Good catch, it's beause it uses TRAMP (https://github.com/Silex/docker.el/blob/master/docker-container.el#L138)

So basically one of the fix could be to use TRAMP multi-hop method and add another sudo: to the TRAMP url... but honestly it looks fragile, TRAMP being already quite fragile.

Silex avatar Apr 25 '21 13:04 Silex

I have no idea how to fix this without creating a monster mess. You should probably use docker context which is partially supported by docker.el

Silex avatar May 22 '23 08:05 Silex