I have this docker-compose to run a Dockerized Jenkins container,
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
I'm able to run
docker ps
but not
docker-compose -v
which gives me docker-compose: not found
.
However I'm able to list it from inside the container:
[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
/ #
I'm sure the user of Jenkins is root, as shown below from inside the container:
/ # whoami
root
What am I missing to make Docker-Compose work from inside a Dockerized Jenkins container?
Jenkins Container in docker-compose file: enter image description here
You should add this rows in docker-compose file.
Don't forget /usr/local/bin/docker-compose file is mustn't empty in your server machine.
Jenkins execute result: enter image description here
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.