需要 jdk,maven 环境
#创建目录
mkdir /home/jenkins_home
#给uid为1000的权限
chown -R 1000:1000 /home/jenkins_home
chown -R 1000:1000 /usr/java/jdk1.8.0_131
chown -R 1000:1000 /usr/local/apache-maven-3.5.4
# 不需要提前拉取镜像,运行的时候没有会自动去拉取
docker run -d -p 10240:8080 -p 10241:50000 -v /home/jenkins_home/:/var/jenkins_home -v /usr/java/jdk1.8.0_131:/usr/local/jdk1.8.0.131 -v /usr/local/apache-maven-3.5.4:/usr/local/maven -v /etc/localtime:/etc/localtime --name myjenkins jenkins/jenkins:latest
初始化密码进入宿主机
/home/jenkins_home/secrets