'Getting permission denied while connecting to /var/run/docker.sock

I am trying to use watchtower container (https://containrrr.dev/watchtower/) in RHEL 8.0 using podman. Since docker is not officially supported by RHEL 8.0, I have not installed docker-engine in this VM. I have started podman.socket service and podman.sock is located on /run/podman/podman.sock

When I give podman-compose up -d command all the other containers start successfully without any error but watchtower container Exits with code (1).

This is the logs generated by watchtower container:

time="2022-01-20T13:45:50Z" level=error msg="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.25/containers/json?filters=%7B%22status%22%3A%7B%22running%22%3Atrue%7D%7D&limit=0\": dial unix /var/run/docker.sock: connect: permission denied"
0

I gave executing permission to /run/podman/podman.sock file but still getting this error.

Snippet of docker-compose.yml with watchtower service.

  watchtower:
    image: index.docker.io/containrrr/watchtower:1.3.0
    volumes:
      - /run/podman/podman.sock:/var/run/docker.sock 

Since I do not have docker.sock, I am mounting podman.sock to docker.sock so that watchtower can communicate with docker API.

How can I fix it? (I don't want to install docker)



Solution 1:[1]

The default podman socket is root:root 660. You may have to create a group, and/or chmod the socket.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GaƩtan RYCKEBOER