Docker-outside-of-docker does not work when running docker as a non-root user.
The feature attempts to mount /var/run/docker.sock, but when running docker as a non-root user as show in the docs, this is the wrong path to the socket...
Docker-outside-of-docker does not work when running docker as a non-root user
@RaphaelMelanconAtBentley When you say non-root user, are you talking about the dev container user or the Docker installed on your host machine?
The host docker is running as root, with a docker group to allow my host's user to use docker without sudo, as per Docker's documentation.
In the devcontainer, I am also using a non-root user, without sudo access.
From what I could find out yesterday, the GID of the host's docker group is different from the one created by the feature...
I might also be running into this problem. I have this feature on a dev container built on top of a custom Docker image that uses a non-root user and access to /var/run/docker.sock is denied. The docker group's GID in the container is 999, but 962 on my host machine; trying to figure out why
I can confirm. This is also not working for me and it seems to be because of the docker group's GID. I was able to workaround this problem by wrapping my target image in a new Dockerfile that manually sets the GID of the docker group to match what is on my system:
Dockerfile:
FROM my_target_image
ARG dockerGid
USER root
RUN addgroup --gid $dockerGid docker \
&& usermod -aG docker local_user
# Reset user back to original non-root user from my_target_image
USER local_user
devcontainer.json:
{
"build": {
"dockerfile": "Dockerfile",
"args": { "dockerGid": "998" } // Have to manually populate the GID of my host's docker group
},
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
}
}