Docker-compose构建jenkins环境

Docker-compose构建jenkins环境

 
1、创建docker在主机的jenkins数据映射目录
mkdir -p /data/jenkins_home
chown -R 1000 /data/jenkins_home
2、用docker-compose安装,当然你也可以用docker run的方式,创建一个docker-jenkins-compose.yml文件。
version: "3"
services:
  jenkins:
    image: jenkins/jenkins:lts
    ports:
      - 8080:8080
      - 50000:50000
    restart: "always"
    container_name: jenkins
    environment:
      JAVA_OPTS: -Duser.timezone=Asia/Shanghai
    volumes:
      - /opt/jenkins/home:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
    privileged: true
    user: root

 

3、启动Jenkins容器
docker-compose -f docker-jenkins-compose.yml up -d
 
4、浏览器访问http://IP:8080
 
——>
[root@sunli-tets ~]# cat /opt/jenkins/home/secrets/initialAdminPassword
22da82a375e14aae95ac8486ea848d81

 

——>
 
 
——>
 
 
 
 
 
 
 
 
 
 
posted @ 2021-04-09 12:22  梦里花落知多少sl  阅读(441)  评论(0编辑  收藏  举报