1、安装docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
2、配置文件
version: "3"
services:
jenkins:
container_name: jenkins
image: jenkins/jenkins:lts
restart: always
environment:
- TZ=Asia/Shanghai
ports:
- "8070:8080"
- "50000:50000"
volumes:
- /docker/jenkins/jenkins_home:/var/jenkins_home
- /docker/jenkins/run/docker.sock:/var/run/docker.sock
- /docker/jenkins/bin/docker:/usr/bin/docker
- /docker/jenkins/data/maven:/usr/local/maven
privileged: true
user: root