将Jenkins插件安装到Docker Jenkins [英] Installing Jenkins Plugins to Docker Jenkins
问题描述
我有以下以jenkins
为基础映像的Dockerfile:
I have the following Dockerfile with jenkins
as the base image:
FROM jenkins
USER root
ENV JENKINS_MIRROR http://mirrors.jenkins-ci.org
RUN for plugin in git-client git ws-cleanup ; do wget -O $JENKINS_HOME/plugins/${plugin}.hpi $JENKINS_MIRROR/plugins/${plugin}/latest/${plugin}.hpi ; done
EXPOSE 8080
我正在尝试安装一些其他插件,但这给我一个错误,提示no such file or directory
I'm trying to install some additional plugins but it gives me an error saying no such file or directory
然后我开始并连接到此构建步骤的容器,以调试"错误:
I then started and connected to the container of this build step in order to "debug" the error:
但是,我找不到原因,因为每个目录似乎都存在.此外,如果我随后在bash中手动运行for循环,则所有插件均已正确安装...
However, I could not find out the cause because every directory seems to exist. Furthermore, if I then run the for-loop manually in the bash, all plugins are installed correctly...
我进一步注意到,如果按如下所示将其安装在根目录中,则可以安装插件:
I further noticed, that the installation of the the plugins works, if I install them in the root directory as follows:
RUN for plugin in git-client git ws-cleanup ; do wget -O ${plugin}.hpi $JENKINS_MIRROR/plugins/${plugin}/latest/${plugin}.hpi ; done
但是,这是错误的位置,因为它们必须放置在$ JENKINS_HOME/plugins目录中
However, this is the wrong place as they have to be placed in the directory $JENKINS_HOME/plugins
为什么我不能在$JENKINS_HOME/plugins
中安装插件?
Why I am not able to install the plugins in $JENKINS_HOME/plugins
?
推荐答案
我看不到您的屏幕截图,但您似乎未遵循官方说明.参见 https://github.com/cloudbees/jenkins-ci.org-docker在安装更多工具"下.注意:
I can't read your screenshots, but you don't seem to be following the official instructions. See https://github.com/cloudbees/jenkins-ci.org-docker under "Installing more tools". Note:
- 您应将插件保存到
/usr/share/jenkins/ref/plugins
- 您可以改用
plugins.txt
文件,其中包含插件的名称,并且可以使用提供的plugins.sh
脚本进行处理.看起来像:
- You should save the plugins to
/usr/share/jenkins/ref/plugins
- You could use a
plugins.txt
file instead, which contains the names of your plug-ins, and you can process with the providedplugins.sh
script. This looks like:
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/plugins.txt
我认为您的方法不起作用的原因是与启动脚本中的某些处理有关.
I think the reason your approach wasn't working was to do with some processing in the start-up script.
这篇关于将Jenkins插件安装到Docker Jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!