1、下载Jenkins 镜像
docker pull jenkins
2、建立volumes 文件夹
mkdir jenkins_home
3、修改权限
sudo chown -R 1000:1000 jenkins_home/
4、编辑 docker-compose.yml
vi docker-compose.yml
version: "3"
services:
jenkins:
container_name: jenkins
image: jenkins
restart: always
volumes:
- ./jenkins_home:/var/jenkins_home
ports:
- "8090:8080"
5、启动
docker-compose up -d
6、打开 127.0.0.1:8090 ,开始设置Jenkins
7、查看docker jenkins日志
docker logs -f jenkins
8、快捷方式
docker run \
-u root \
--rm \
-d \
-p 8090:8080 \
-p 50000:50000 \
-v $PWD/jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /data/apache-maven-3.6.2:/data/apache-maven-3.6.2
--name my_jenkins \
jenkinsci/blueocean