Jenkins制作升级后的镜像

官方下载的Jenkins镜像中,Jenkins.war不是最新的,导致一些插件自动安装失败,需要手动下载war包然后进行升级镜像制作,再k8s中更换启动镜像即可成功更新Jenkins,也解决了某些插件提示安装失败的问题。

1、下载最新的Jenkins.war包文件

1
2
3
4
5
6
7
8
9
[root@node1 dockerfile]# tree
.
├── dockerfile
└── jenkins.war


[root@node1 dockerfile]# cat dockerfile
FROM jenkins/jenkins:latest
COPY ./jenkins.war /usr/share/jenkins/

2、使用docker build命令构建Jenkins镜像

1
2
3
4
5
6
7
8
9
10
11
[root@node1 dockerfile]# docker build -f dockerfile -t "jenkins/jenkins:2.379" .
Sending build context to Docker daemon 98.37MB
Step 1/3 : FROM jenkins/jenkins:latest
---> 55860ee0cd73
Step 2/3 : MAINTAINER zy
---> Using cache
---> 70a95ab88c80
Step 3/3 : COPY ./jenkins.war /usr/share/jenkins/
---> 445ab11c1156
Successfully built 445ab11c1156
Successfully tagged jenkins/jenkins:2.379

3、查看已构建成功的镜像

1
2
[root@node1 dockerfile]# docker images | grep 2.379
jenkins/jenkins 2.379 445ab11c1156 About a minute ago 541MB