docker swarm安装与配置jenkins

docker swarm安装与配置jenkins

安装jenkins

1.创建jenkins本地目标
mkdir -p /usr/local/jenkins
chmod -R 777 /usr/local/jenkins
2.创建docker swarm配置文件

jenkins绑定宿主机java、maven

version: "3.6"
services:
  jenkins:
    image: jenkins/jenkins
    ports:
      - "8080:8080"
      - "50000:50000"
    volumes:
      - /usr/local/apache-maven-3.5.3:/usr/local/apache-maven-3.5.3
      - /usr/local/jdk1.8.0_171:/usr/local/jdk1.8.0_171
      - /usr/local/jenkins:/var/jenkins_home
      - /etc/localtime:/etc/localtime
      - /etc/docker:/etc/docker
    networks:
      - platform
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]
networks:
  platform:
    external: true
3.部署jenkins
docker stack deploy -c docker-jenkins.yml jenkins
4.登录jenkins

浏览器访问:http://宿主机:8080,密码文件位置/var/jenkins_home/secrets/initialAdminPassword

查看docker 容器 id
docker ps 
1d843e64ae41 jenkins/jenkins:latest jenkins_jenkins.1.ow18l7i39zwhriossu5gibfq9
查询密码文件内容
docker exec -it 1d843e64ae41 cat /var/jenkins_home/secrets/initialAdminPassword
密码
f164a3a0f5134def9f7c4cdb6b453d01

输入密码登录jenkins

jenkins配置

1.选择安装推荐的插件

在这里插入图片描述
等待插件安装完成

2. 设置管理员密码

你可能感兴趣的:(docker,docker,jenkins)