使用 Docker Jenkins 容器管道构建 docker 映像时找不到 Docker

2024-04-15

我有一个 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

以下是我运行 Jenkins 映像的方式:

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 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

Source https://stackoverflow.com/a/43594065/1094246

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Docker Jenkins 容器管道构建 docker 映像时找不到 Docker 的相关文章

随机推荐