https://adamtheautomator.com/jenkins-docker/#Running_Jenkins_using_Docker_Compose_with_Volumes
- 安装
docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
- 配置Jenkins
docker-compose.yml
version: '3.7'
services:
jenkins:
image: jenkins/jenkins:lts
privileged: true
user: root
ports:
- 8080:8080
- 50000:50000
container_name: myjenkins
volumes:
- /var/jenkins_data:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- 部署启动
# Start the my-jenkins-3 container
sudo docker-compose up -d
# Get the initial admin password
sudo docker exec myjenkins cat /var/jenkins_home/secrets/initialAdminPassword
# Confirm the my-jenkins-3 container is running
docker ps
来源:oschina
链接:https://my.oschina.net/u/3278229/blog/4936926