Replies: 4 comments 1 reply
-
I'm also having an issue with a rootless docker install I'm playing with. Seems to be a permissions issue but maybe I'm doing something wrong in my compose file. @wollomatic do you have any experience with running rootless docker? I was able to run tecnativa/docker-socket-proxy without these errors. I've tried adding user: 65534:1001 as in your documentation and also 1001:1001 with no luck. Error: This is what I got: compose.yaml
docker compose --env-file up
|
Beta Was this translation helpful? Give feedback.
-
Hi @crazytimmy, Thanks for reaching out. I haven't used Docker rootless for several reasons, but here are some thoughts: The reason tecnativa/docker-socket-proxy works is that it runs with root privileges by default. You can achieve the same behaviour with socket-proxy by setting What are the owner and group of the Docker socket? Which file permissions are set? Best regards, |
Beta Was this translation helpful? Give feedback.
-
@wollomatic thanks for taking the time to respond. I figured it out and most definitely had to do with my lack of knowledge in Docker and some assumptions I made. Quick answer is I got it working by... following your instructions (shocker I know). I had to run my compose with If you know why and have the time to help me understand why the docker GID is needed I would appreciate and try hard to understand it more. Here are the permissions you were asking for:
For anyone else stuck on this run:
where 996 is your docker's group id (GID) For completion sake here's my compose.yaml used for testing:
SOCKET_PATH maps to: |
Beta Was this translation helpful? Give feedback.
-
Hi @crazytimmy, thanks for the feedback and the detailed information. I'll start with the second question:
That's because of this:
You're mounting the (external) file from ${SOCKET_PATH} inside the container to /var/run/docker.sock. Because /var/run/docker.sock inside the container is the default location where socket-proxy tries to connect to the socket. However, if you explicitly set SP_SOCKETPATH to ${SOCKET_PATH}, socket-proxy cannot find the socket, because it's still mounted to /var/run/docker.sock inside the container. The other question is complex without knowing the full configuration, but it likely involves user namespace mapping. Even though the Docker socket has a GID of 166531 on the host, the container's user namespace maps the container's GID 996 to the host's docker group. This mapping allows the container to access the Docker socket as if it were a member of the docker group on the host, enabling the necessary permissions for communication with the Docker daemon. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have been rebuilding a new Ubuntu server, but this time, the docker and all others dockers and portainer-ce will run in rootless mode (I hope).
It is today working for the Portainer docker only. I cannot build any stack yet, still this error message
failed to deploy a stack: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
When checking my Traefik config file and reading your post concerning this special mode, if I understood well, Traefik will run in rootless mode when your proxy will need root to run.
The "rootless" socket PATH is today:
/run/user/1000/docker.sock
.My proxy config for Traefik v3.0
dockerproxy: image: wollomatic/socket-proxy:1.3.1 container_name: t-docker-socket-proxy command: - '-loglevel=info' - '-allowfrom=traefik' - '-listenip=0.0.0.0' - '-allowGET=/v1\..{1,2}/(version|containers/.*|events.*)' - '-watchdoginterval=3600' - '-stoponwatchdog' - '-shutdowngracetime=10' restart: unless-stopped read_only: true mem_limit: 64M cap_drop: - ALL security_opt: - no-new-privileges user: 65534:1000 # change gid from 998 to the gid of the docker group on your host volumes: - /run/user/1000/docker.sock:/var/run/docker.sock:ro networks: - socket-t networks: socket-t: driver: bridge internal: true attachable: false
Beta Was this translation helpful? Give feedback.
All reactions