繁体   English   中英

在 Jenkins 中构建时未找到 docker

[英]docker not found when building in Jenkins

I am trying to make sure my docker work or not in my Jenkins, I am running Jenkins in docker and it was running but when I check in Jenkins Pipeline, it said docker: not found

这是我的docker-compose.yml

version: '3.7'

services:

  jenkins:
    image: jenkinsci/blueocean:latest
    user: root
    privileged: true
    restart: always
    ports:
      - 8080:8080
    volumes:
      - ./jenkins_home:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker

  registry:
    image: registry
    container_name: registry
    restart: always
    ports:
      - 5000:5000

然后我运行sudo docker-compose up -d然后 Jenkins 正在运行,我能知道为什么没有找到 docker 吗? 我的 docker-compose 错了吗?

您不需要绑定- /usr/bin/docker:/usr/bin/docker ,因为- /var/run/docker.sock:/var/run/docker.sock足以与主机 docker 交互。 您不应将可执行文件与 docker 容器绑定

从撰写文件中删除它,它应该可以工作。

- /usr/bin/docker:/usr/bin/docker

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM