docker下部署jenkins

Jenkins

拉取镜像

#53上的docker jenkins
#必须要给jenkins用户组1000权限
#jenkins:x:1000:1000::/home/jenkins:/bin/bash
sudo docker run -itd -p 8080:8080 -p 50000:50000 --name jenkins --privileged=true  --restart=always -m 3000M -v /data/jenkins_home/:/var/jenkins_home -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime -v /etc/timezone:/etc/timezone jenkins/jenkins:lts
docker pull jenkins/jenkins

当前版本:2.136

安装说明看:https://hub.docker.com/_/jenkins/

创建工作目录,注意权限

mkdir -p /docker/jenkins/jenkins_home
chmod 777 /docker/jenkins/jenkins_home
docker run -p :8080 -p :50000 -d --name jenkins \
  -v /docker/jenkins/jenkins_home:/var/jenkins_home \
  -v /root/.m2:/var/jenkins_home/.m2 \
  -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime \
  -e VIRTUAL_HOST=jenkins.wilmarops.cn \
  -e VIRTUAL_PORT=8080 \
  -e JAVA_OPTS=-Duser.timezone=Asia/Shanghai \
  -e JAVA_OPTS=-Dhudson.footerURL=http://www.wilmar-international.com/ \
  jenkins/jenkins

看后台 admin 的密码 docker logs -f jenkins

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

2a9c66d5a8f147a4a994ade56857d374

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

访问:http://jenkins.wilmarops.cn 装插件,管理员:admin/admin123

LDAP 配置

注意:LDAP 配错了就登不进去了!
建议做好 /var/jenkins_home/config.xml 备份
进不去后的解锁方式:修改 /var/jenkins_home/config.xmltrue 改为 false,就不需要登入(root 用户问题没关系)

Server: ldap://172.16.253.35:3268
root DN: DC=wilmar,DC=cn
User search filter: sAMAccountName={0}
Manager DN: CN=wilmar_ cas,CN=Users,DC=wilmar,DC=cn
Manager Password: sh.1234
Display Name LDAP attribute: displayname
Email Address LDAP attribute: mail

注意保存前一定要在“安全矩阵”里面设置 Anonymous Users 为 Administer,修改一个 AD 用户为管理员后再改回去

下载 JDK、Maven

自动构建,钩子,定时

语言问题、时区问题尚未解决

"Manage Jenkins >> Script Console" and type

System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'America/Los_Angeles')

系统里显示的时区设置还是 UTC,可能要设置变了:user.timezone user.language

上一篇:kustomize简单使用


下一篇:当未使用C#加入Microsoft Active Directory中的域时,如何对ldap进行身份验证