Jenkinsfile无法运行Docker

时间:2019-05-14 00:13:50

标签: docker jenkins-pipeline

我正在关注此博客https://getintodevops.com/blog/building-your-first-docker-image-with-jenkins-2-guide-for-developers 1)git克隆仓库-完成 2)本地构建图像-完成 3)本地运行-完成 4)“立即构建”出现以下错误

Running on Jenkins in /Users/mano/.jenkins/workspace/so_build_docker_with_jenkins
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Clone repository)
[Pipeline] checkout
No credentials specified
Cloning the remote Git repository
Cloning repository https://github.com/getintodevops/hellonode.git
 > git init /Users/mano/.jenkins/workspace/so_build_docker_with_jenkins # timeout=10
Fetching upstream changes from https://github.com/getintodevops/hellonode.git
 > git --version # timeout=10
 > git fetch --tags --progress https://github.com/getintodevops/hellonode.git +refs/heads/*:refs/remotes/origin/*
 > git config remote.origin.url https://github.com/getintodevops/hellonode.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url https://github.com/getintodevops/hellonode.git # timeout=10
Fetching upstream changes from https://github.com/getintodevops/hellonode.git
 > git fetch --tags --progress https://github.com/getintodevops/hellonode.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 2241f48e193a956e9c25706555ee3e4c9c0728c5 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 2241f48e193a956e9c25706555ee3e4c9c0728c5
Commit message: "feat: dummy test"
First time build. Skipping changelog.
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build image)
[Pipeline] sh
+ docker build -t getintodevops/hellonode .
/Users/mano/.jenkins/workspace/so_build_docker_with_jenkins@tmp/durable-91e2f197/script.sh: line 1: docker: command not found
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE

1 个答案:

答案 0 :(得分:0)

我删除了所有docker和Jenkins的安装,然后对Jenkins和docker进行了干净的安装,并开始为我工作