Docker for Mac, working with local Jenkins slave

After installing Docker for Mac and having good experience pulling / running different images, now trying to make this work with my locally installed Jenkins on my mac (with the default slave config).

To repro this issue, su as jenkins on your mac terminal shell:

sudo su jenkins

First thing I needed to do: PATH needed to be set so docker commands could be accessed by the slave:

PATH=/Applications/Docker.app/Contents/Resources/bin:$PATH

After this I could run docker (no args) and get the help.

docker

However running the ps command tells me that the daemon is not found…

docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

I assume that the Jenkins user is not able to access the daemon on the xhyve VM? I saw some stuff here about adding the jenkins user to a docker group but that seems out of date? Any way to resolve this problem so I can get my local jenkins communicating with the docker daemon?

Hello, did you figure out how to resolve this issues? I’m in the same boat.

After running the path command in your post and then running the Docker Images command, I receive this permission 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.30/images/json: dial unix /var/run/docker.sock: connect: permission denied

My main issue is that I have Jenkins and Docker installed. Docker works fine when I run docker commands from my user in the terminal but if I run the docker commands in a Jenkins build with a Jenkins shell build step, I get “Docker command not found”

Is there an answer to this question?