Skip to content

Docker安装Jenkins 迁移

拉取Jenkins镜像

bash
docker pull jenkins/jenkins

挂载目录

在宿主机上创建jenkins挂载目录

bash
mkdir /usr/local/software/jenkins

授权

给文件权限,方便jenkins写入数据

bash
chmod 777 /usr/local/software/jenkins

运行Jenkins容器

bash
docker run -d -p 10010:8080 -p 10011:50000 -v /usr/local/software/jenkins:/var/jenkins_home -v /etc/localtime:/etc/localtime --name qc-jenkins jenkins/jenkins

配置清华大学镜像源

bash
cd /usr/local/software/jenkins
vim hudson.model.UpdateCenter.xml

https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

获取管理员密码

bash
cd /usr/local/software/jenkins
cat secrets/initialAdminPassword