Score:0

Portainer can't access docker socket without chmod 666 workaround

us flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.