詹金斯 - 无法运行程序“docker”

时间:2017-05-09 07:56:44

标签: bash docker jenkins continuous-integration calabash

尝试使用具有声明性管道的docker代理...

pipeline
{
    agent
    {
        docker
        {
            image 'rubygem/calabash-cucumber'
        }
    }
...

构建作业找到docker镜像,但随后跳过所有阶段并退出Java异常:

[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
java.io.IOException: Cannot run program "docker": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at hudson.Proc$LocalProc.<init>(Proc.java:245)
    at hudson.Proc$LocalProc.<init>(Proc.java:214)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:850)
    at hudson.Launcher$ProcStarter.start(Launcher.java:384)

任何人都知道为什么会这样吗?我在Jenkins常规设置中添加了所有bash PATH变量,将jenkins User添加到了staff组。没人帮忙。

1 个答案:

答案 0 :(得分:2)

为zshell(或其他文件)添加〜/ .zshenv以将docker放入路径中。我这样做了,问题解决了:

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

我在https://stackoverflow.com/a/44197275/2557645

回答