STEP1: 下载jenkins镜像
docker pull jenkins/jenkins
如果报错:unauthorized: authentication required
可以添加docker镜像加速:
vim /etc/docker/daemon.json
{"registry-mirrors": ["https://registry.docker-cn.com"]}
重启docker服务使设置生效:
systemctl restart docker
STEP 2: 创建目录docker-compose,并在其目录下定义docker-compose.yml
version: '3'
services:
jenkins:
image: 'jenkins/jenkins'
container_name: jenkins
restart: always
ports:
- '8080:8080'
- '50000:50000'
volumes:
- '/v