美文网首页
dcoker-compose安装jenkins

dcoker-compose安装jenkins

作者: 卫彬TM | 来源:发表于2019-11-19 16:45 被阅读0次

安装jenkins

image.png

docker-compose.yml:

version: '3'
services:
  jenkins:
    image: 'jenkins/jenkins:lts'
    container_name: jenkins
    restart: always
    ports:
      - '8080:8080'
      - '50000:50000'
    volumes:
      - '/data/jenkins_home:/var/jenkins_home'

docker_run_install_jenkins.sh:

#!/bin/bash

docker run --name jenkins \
       -d \
       -p 8080:8080 \
       -p 50000:50000 \
       -v /data/jenkins_home:/var/jenkins_home \
       --restart always \
       jenkins/jenkins:lts

pre_install_jenkins.sh:

#!/bin/bash

mkdir -p /data/jenkins_home
chown -R 1000:1000 /data/jenkins_home

在jenkins目录运行以下命令:

# 给脚本授权
chmod u+x *.sh
# 创建Jenkins数据目录(用作持久卷)
./pre_install_jenkins.sh
# 启动Jenkins容器
docker-compose up -d

运行 cat /data/jenkins_home/secrets/initialAdminPassword 获取初始密码。

以上参考:链接:https://www.jianshu.com/p/0fefc7e5cd0a

相关文章

网友评论

      本文标题:dcoker-compose安装jenkins

      本文链接:https://www.haomeiwen.com/subject/gmhdictx.html