Environment: Alpine Linux (3.18)
I've got a portainer docker container that can't access the docker socket. I've added my user to the docker group. I make the container with the following command:
docker run -d --restart always -p 9001:9000 -v /var/run/docker.sock:/var/run/d
ocker.sock -v portainer_data:/data portainer/portainer-ce
But it can't connect to the socket (excerpt from the log files below)
2023/08/26 14:59:56 background schedule error (endpoint snapshot). Unable to create snapshot (endpoint=local, URL=unix:///var/run/docker.sock) (err=Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/_ping: dial unix /var/run/docker.sock: connect: permission denied)
Note: I've already added the user to the docker group
If I try and start the portainer docker explicitly using the docker group with group-add docker
docker run -d --restart always -p 9001:9000 --group-add docker -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
I still get the below error and am unable to create the container
docker: Error response from daemon: Unable to find group docker: no matching entries in group file.
I'm very much trying to avoid a blanket chmod 666
for the socket due to the security concerns but I'm not sure how to get around this.
Any help would be appreciated.