Jenkins – Cannot run program “docker”

Trying to use a docker agent with a declarative pipeline…

            image 'rubygem/calabash-cucumber'

The build job finds the docker image but then skips all stages and quits with a Java exception:

  • Passing arguments to another process as they were entered on the command line with a bash script
  • How to have bash script answer interactive prompts (no y/n only)?
  • How do I know when my docker mysql container is up and mysql is ready for taking queries?
  • How to downloaded from remote location and execute script on container start Docker?
  • Resolving env inside another env
  • Connect to mongodb on centos7 docker image
  • [test_automation] Running shell script
    + docker pull rubygem/calabash-cucumber
    Using default tag: latest
    latest: Pulling from rubygem/calabash-cucumber
    Digest: sha256:cc6a06017009f0a68b93db33c2ced09a224ce2b8754efadaed16c18190e56ee4
    Status: Image is up to date for rubygem/calabash-cucumber:latest
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] sh
    [test_automation] Running shell script
    + docker inspect -f . rubygem/calabash-cucumber
    [Pipeline] withDockerContainer
    [Pipeline] // withDockerContainer
    [Pipeline] }
    [Pipeline] // node
    [Pipeline] stage
    [Pipeline] { (Declarative: Post Actions)
    [Pipeline] echo
    All stages finished.
    [Pipeline] echo
    Cleaning up workspace ...
    [Pipeline] echo
    Build failed!
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] End of Pipeline Cannot run program "docker": error=2, No such file or directory
        at java.lang.ProcessBuilder.start(
        at hudson.Proc$LocalProc.<init>(
        at hudson.Proc$LocalProc.<init>(
        at hudson.Launcher$LocalLauncher.launch(
        at hudson.Launcher$ProcStarter.start(

    Anyone know why this happens? I’ve added all my bash PATH variables in Jenkins general settings, added jenkins User to staff group. None helped.

  • Saving function output into a variable named in an argument
  • Docker process suspends and gets killed
  • Why does parse_git_branch fail ONLY in Docker terminal window
  • How to access environment variables set by docker run from monit controlled processes inside the container
  • How to persist 'ln' in Docker with Ubuntu
  • execute docker commands from bash file
  • One Solution collect form web for “Jenkins – Cannot run program “docker””

    Adding ~/.zshenv for zshell (or other file) to put docker in the path. I did this and problem resolved:

    $ cat ~/.zshenv
    export PATH=/usr/local/bin:$PATH

    I answered at

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