webhookd icon indicating copy to clipboard operation
webhookd copied to clipboard

webhookd has no permission for accessing /var/run/docker.sock

Open bastianh opened this issue 2 years ago • 2 comments
trafficstars

Hi,

when trying to access docker from within the script it fails with:

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
error: exit status 1

Thanks for your work.

bastianh avatar Jan 31 '23 07:01 bastianh

as a workaround you can, if using docker-compose run the webhookd in the docker group.

for example if the docker group is 124 on your host:

services:
  webhookd:
    hostname: webhookd
    user: 1000:124
    image: ncarlier/webhookd:edge-distrib

bastianh avatar Jan 31 '23 08:01 bastianh

It's more of a solution than a workaround ;) There are not many "clean" solutions to this problem. You can use the root user or privileged mode but it is not recommended for security reasons. IMO the best thing to do is your solution.

ncarlier avatar Jan 31 '23 09:01 ncarlier