Docker Community Forums

Share and learn in the Docker community.

Jenkins -dial unix var run docker sock connect permission denied macos

I’m running Jenkins locally on MacOS and have docker installed on my machine as well.

I have a Jenkins job that uses a Jenkins file to

  1. Build a maven project
  2. Build a docker image
  3. Deploy to docker hub.

I have all the docker plugins installed in Jenkins but when the Build step is executed I get…

Got permission denied while trying to connect to the Docker daemon 
socket at unix:///var/run/docker.sock: Post 
http://%2Fvar%2Frun%2Fdocker.sock/v1.39/build?
buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=w6ypm3t1b0qefyxh9omfvntru&shmsize=0&t=app-web&target=&ulimits=null&version=1: dial unix /var/run/docker.sock: connect: permission denied

I can’t seem to change permissions on the following but can on the symbolic link

lrwxr-xr-x   1 macuser          staff              72 Jun 30 20:36 docker.sock -> /Users/john/Library/Containers/com.docker.docker/Data/docker.sock

I have looked around and see that other people have similar issues, but I just can’t seem to get this to work.
I even tried changing ownership sudo chown jenkins:jenkins /var/run/docker.sock

But nothing seems to work :frowning:

Any help greatly appreciated