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.

  • docker1.7 Error response from daemon: Cannot start container: invalid argument
  • docker-compose with mysql init script
  • How to access private Docker repository in OpsWorks ECS Layer?
  • Docker Container with Apache Spark in standalone cluster mode
  • Docker + Rspec + Capybara - arguments[0] is undefined
  • How should I pass sensitive environment variables to Amazon ECS tasks?
  • 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

  • Docker Swarm creating real cluster: Registered and Removed
  • Cloning Git-Hub repository from docker Jenkins instance
  • How to build docker source code after modifying it?
  • kubernetes stateful set connection
  • Pull, virtualize, and bash into a docker image
  • How to Copy file to stopped docker container
  • 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.