I'm facing this weird problem , struggling to solve since almost couple of days.
Working: On mac mini command prompt , I switch to jenkins user and can run docker command without any problem.
Not Working: but when I run a jenkins job , inside shell command step docker is not recognized.
I'm getting error
docker: command not found
docker --version
But mentioning explicit path of docker , does work
/Users/buildserver/Library/Group\ Containers/group.com.docker/bin/docker --version
Question : Why docker command can't look into correct path ?
Permissions
lrwxr-xr-x 1 buildserver staff 71 Oct 14 10:44 docker -> /Users/buildserver/Library/Group Containers/group.com.docker/bin/docker
jenkins uses is part of staff group.
Thanks in advance.
Regards, Vikram
For others (Late but worthy), I installed Jenkins via Brew, so I add Docker's path to the file below: /usr/local/Cellar/jenkins-lts/2.176.3/homebrew.mxcl.jenkins-lts.plist (Whole file looks like below)
Then restart Jenkins' service:
More question
The
PATH
which Jenkins jobs start with isn't the same as the path which the Jenkins user sees in bash. In the Jenkins UI you can edit the environment varables (from Manage Jenkins/Configure System), and add the Docker folder toPATH
:Some more detail in the answer to this question.