我有一个Jenkins作为docker容器运行,现在我想使用管道构建Docker映像,但是Jenkins容器总是告诉未找到Docker。
[simple-tdd-pipeline] Running shell script + docker build -t simple-tdd . /var/jenkins_home/workspace/simple-tdd-pipeline@tmp/durable- ebc35179/script.sh: 2: /var/jenkins_home/workspace/simple-tdd- pipeline@tmp/durable-ebc35179/script.sh: docker: not found
这是我运行詹金斯图像的方式:
docker run --name myjenkins -p 8080:8080 -p 50000:50000 -v /var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkins
Jenkins映像的DockerFile是:https : //github.com/jenkinsci/docker/blob/9f29488b77c2005bbbc5c936d47e697689f8ef6e/Dockerfile
您缺少Docker客户端。这样在Dockerfile中安装:
RUN curl -fsSLO https://get.docker.com/builds/Linux/x86_64/docker-17.04.0-ce.tgz \ && tar xzvf docker-17.04.0-ce.tgz \ && mv docker/docker /usr/local/bin \ && rm -r docker docker-17.04.0-ce.tgz