将Jenkins插件安装到Docker Jenkins

编程入门 行业动态 更新时间:2024-10-24 14:15:25
本文介绍了将Jenkins插件安装到Docker Jenkins的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有以下以jenkins为基础映像的Dockerfile:

I have the following Dockerfile with jenkins as the base image:

FROM jenkins USER root ENV JENKINS_MIRROR mirrors.jenkins-ci 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?

推荐答案

我看不到您的屏幕截图,但您似乎未遵循官方说明.参见 github/cloudbees/jenkins-ci-docker在安装更多工具"下.注意:

I can't read your screenshots, but you don't seem to be following the official instructions. See github/cloudbees/jenkins-ci-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 provided plugins.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

本文发布于:2023-10-16 00:11:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1495904.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   Jenkins   Docker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!