我有这个docker-compose来运行Dockerized Jenkins容器,
version: '2'
services:
jenkins:
image: 'jenkinsci/blueocean'
environment:
- JENKINS_OPTS="--prefix=/jenkins"
user: 'root'
ports:
#host:container
- '8888:8080'
volumes:
#host:container
- /dati/jenkins:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin:/usr/bin
- /usr/local/bin:/usr/local/bin
我可以跑步
docker ps
但不是
docker-compose -v
这给了我docker-compose: not found
。
但是我可以从容器内部列出它:
[root@dev-machine ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d183202f2b2a jenkinsci/blueocean "/sbin/tini -- /usr/…" 15 hours ago Up 15 hours 50000/tcp, 0.0.0.0:8888->8080/tcp jenkins-compose_jenkins_1
[root@dev-machine ~]# whereis docker-compose
docker-compose: /usr/bin/docker-compose
[root@dev-machine ~]# docker exec -it d183202f2b2a sh
/ # ls -l /usr/bin/docker-compose
-rwxr-xr-x 1 root root 218 Oct 26 09:09 /usr/bin/docker-compose
/ #
我确定Jenkins的用户是root用户,如下图所示:
/ # whoami
root
我想从Dockerized Jenkins容器中使Docker-Compose工作的我缺少什么?