boot2docker image has a
docker group one can use to access docker socket. I used to run container with bind mounting /var/run/docker.sock and docker binary to interact with docker from container. So have been using --group-add 100 (docker gid on boot2docker) to grant access to docker socket whatever non-root user is defined on the docker image.
docker=100 group doesn’t seem to exist on Docker for Mac VM.
Simple workaround is to run with --group-add staff
Maybe this isn’t the best way to setup a container with access to host docker socket, would then be useful to document it - I can’t find an official doc on this topic.
Steps to reproduce the behavior
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker --group-add 100 -it --rm jenkins bash.
- Then from container’s shell run
Cannot connect to the Docker daemon. Is the docker daemon running on this host?