docker: command not found ( mac mini ) only happens in jenkins shell step but work from command prompt

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.

  • Unable to connect to the secure docker port using curl
  • Docker build error - OSError: [Errno 2] No such file or directory
  • My docker container has no internet
  • How MongoDB works with Docker
  • Dockerized jenkins is a good choice?
  • Is it possible to create image from file on docker host using docker API?
  • 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

  • Unable to build docker image, “must be a root user”
  • How to connect my NodeJS with my Angular (in Nginx)
  • setting gitlab with docker registry error 500
  • AWS ecs task definition variables
  • How to set a path on host for a named volume in docker-compose.yml
  • Two Users in Docker
  • One Solution collect form web for “docker: command not found ( mac mini ) only happens in jenkins shell step but work from command prompt”

    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 to PATH:

    PATH -> $PATH:/Users/buildserver/Library/Group\ Containers/group.com.docker/bin/
    

    Some more detail in the answer to this question.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.