#启动容器
# 8080端口是jenkins的dashboard使用的;50000是jenkins的JNLP使用的
docker run --name MyJenkins --privileged -p 9080:8080 -p 50000:50000 -itd centos:7 /usr/sbin/init
# 进入容器
docker exec -it MyJenkins /bin/bash
安装
# 安装jdk、各种依赖、jenkins
yum install wget git initscripts -y && \
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo && \
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key && \
yum upgrade -y && \
yum install jenkins java-11-openjdk-devel -y
启动
systemctl daemon-reload
systemctl start jenkins
systemctl status jenkins
进入dashboard
浏览器打开http://hostname.ltd:9080 会提示输入初始化密码(通过容器内cat /var/jenkins_home/secrets/initialAdminPassword
查看)。然后一步一步下去,再创建管理员账户就行了
评论区