例如在docker启动的jenkins中编写脚本的时候,docker build报错提示,docker: not found
提示:解决办法就是把宿主机的docker命令传过去
[root@localhost ~]# docker -v
Docker version 1.13.1, build 7d71120/1.13.1
首先看一下我的启动命令,容器开启后进入容器输入docker build提示找不到docker 命令
docker run --name jenkins-test -p 7080:8080 -p 50002:50000 -v /home/jenkins3/jenkins_home:/var/jenkins_home -v /home/jenkins_settings:/var/settings -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -d -u 0 jenkins/jenkins:latest-jdk8
修改docker版本,之后无压力启动
docker run --name jenkins-test -p 7080:8080 -p 50002:50000 -v /home/jenkins3/jenkins_home:/var/jenkins_home -v /home/jenkins_settings:/var/settings -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -d -u 0 jenkins/jenkins:latest-jdk8