1.docker方式安装jenkins server

镜像版本最好最新的

参考官网:https://www.jenkins.io/download/

mkdir -p /data/jenkins_home
chmod 777 -R /data/jenkins_home

docker run -itd --name jenkins \
-p 8080:8080 \
-p 50000:50000 \
-e JAVA_OPTS="-Dorg.apache.commons.jelly.tags.fmt.timeZone='Asia/Shanghai'" \
--privileged=true  \
--restart=always \
-v /data/jenkins_home:/var/jenkins_home jenkins/jenkins:2.426.2

 

查看起始密码:/var/jenkins_home/secrets/initialAdminPassword 或者docker logs -f jenkins

 

2.jenkins node安装

系统管理--节点管理--新建节点

 

 启动命令

#!/bin/bash

nohup java -jar agent.jar -jnlpUrl http://192.168.1.200:8080/computer/build01/jenkins-agent.jnlp -secret @secret-file -workDir "/opt/jenkins" &