解决Jenkins插件安装的问题(Docker方式安装Jenkins)
需求情况:
在以docker形式运行jenkins,每次重新启动时,都是需要安装插件,
如果网络不好还安装不成功等,导致该插件运行不成功,使得jenkins不能正常工作。
我们在jenkins的镜像中,预制安装好plugins的jenkins的镜像。
$ ls
Dockerfile plugins.txt
$ cat Dockerfile
FROM jenkins/jenkins:2.249.3
#ENV JAVA_OPTS -Djenkins.install.runSetupWizard=false
#ENV JENKINS_USER admin
#ENV JENKINS_PASS admin
#env https_proxy "http://10.158.100.9:8080"
#env http_proxy "http://10.158.100.9:8080"
COPY plugins.txt /usr/share/jenkins/plugins.txt
#RUN jenkins-plugin-cli -f /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/plugins.txt
$ cat plugins.txt
......
workflow-job:2.40
workflow-multibranch:2.22
workflow-scm-step:2.11
workflow-step-api:2.23
workflow-support:3.6
......