简体   繁体   中英

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

here is my 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

then I run sudo docker-compose up -d then the Jenkins is running, can I know why the docker not found? is my docker-compose wrong?

You do not need to bind - /usr/bin/docker:/usr/bin/docker , as - /var/run/docker.sock:/var/run/docker.sock is engough to interact with host docker. you should not bind executable with docker container

remove this from the compose file and it should work.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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