Do we have docker group on Mac?

I have installed docker on Mac and everything is running fine. I am using a Jenkins docker image and running it. While using Jenkins as a CI server and to build further images by running docker commands through it, I came to know that we have to bind mount the /var/run/docker.sock while running the Jenkins images so it can access the docker daemon.

I did that and installed docker CLI inside Jenkins’s container but while running “docker ps” or any other docker command it is throwing the below error:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.28/containers/json: dial unix /var/run/docker.sock: connect: permission denied

When i connect to conatiner as a root user , it works fine. But switching to ‘jenkins’ user throws above error. I have already added ‘jenkins’ user to sudo list but does not help.

I found few articles suggesting to add ‘jenkins’ user to ‘docker’ group but to my surprise I do not find any docker group on Mac or inside container.

Any help is much appreciated. Thanks

1 Like

I have the exact same issue, but then on CircleCI. It seems that on CircleCI itself, they found a workaround. In the build script, I simply invoke “setup_remote_docker” in the container and afterwards I can execute any Docker command without problems (so, docker in docker). When I run the build script locally (using circleci build), I get the error that you describe.

So, docker build . works on CircleCI, but not locally.
sudo docker build . works locally, but NOT on CircleCI.

I think that without sudo is the “correct” way, since that works where it really matters (CircleCI), but I want to be able to test my buildscript locally before pushing it (to avoid unnecessary builds and commits and time spent).

I hope somebody will be able to provide insight. Have you had any results yet?