简体   繁体   English

使用Docker映像安装Jenkins插件

[英]Install Jenkins plugins using Docker image

Say we use a Docker image to run Jenkins with a container. 假设我们使用Docker映像来通过容器运行Jenkins。 Is there a way to install plugins in the image so we don't have to re-install if we create a new Jenkins server? 有没有办法在映像中安装插件,因此如果我们创建新的Jenkins服务器,就不必重新安装?

Something like: 就像是:

FROM jenkins/jenkins:lts
RUN install jenkins-plugin-a
RUN install jenkins-plugin-b

etc 等等

You need to create a plugins.txt file which contains list of plugins and use it in Dockerfile - 您需要创建一个包含插件列表的plugins.txt文件,并在Dockerfile使用它-

FROM jenkins/jenkins:lts
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt

It's there in the official documentation. 在官方文档中。

Ref - https://github.com/jenkinsci/docker (Preinstalling plugins) 参考-https: //github.com/jenkinsci/docker (预安装插件)

Sample plugins.txt - https://github.com/jenkinsci/docker/blob/master/tests/install-plugins/pluginsfile/plugins.txt 示例plugins.txt- https://github.com/jenkinsci/docker/blob/master/tests/install-plugins/pluginsfile/plugins.txt

PS - I haven't tested it yet but it's supposed to work. PS-我还没有测试过,但是应该可以用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM