【问题标题】:Install Plugins fails in jenkins docker image在 jenkins docker 映像中安装插件失败
【发布时间】:2019-11-13 03:14:06
【问题描述】:

我有一个自定义 Jenkins master 的 Dockerfile,如下所示:

FROM jenkins/jenkins:lts
USER root
ENV http_proxy http://xx.xx.xx.xx:8080
ENV https_proxy http://xx.xx.xx.xx:8080
RUN apt-get update
RUN apt-get install -y --allow-unauthenticated ldap-utils curl wget vim nano sudo git
RUN adduser jenkins sudo
User jenkins
ENV http_proxy http://xx.xx.xx.xx:8080
ENV https_proxy http://xx.xx.xx.xx:8080
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN  /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
RUN echo 2.176.2 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state
RUN echo 2.176.2 > /usr/share/jenkins/ref/jenkins.install.InstallUtil.lastExecVersion
EXPOSE 9081
EXPOSE 50000

我预计插件将在 docker build 命令期间安装 docker build --no-cache -t jenkins .

但是 install-plugins.sh 无法安装插件

-max-time 60 https://updates.jenkins.io/download/plugins/structs-plugin/1.5/structs-plugin.hpi -o /usr/share/jenkins/ref/plugins/structs-plugin.jpi)
Failed to download plugin: structs or structs-plugin
curl: (22) The requested URL returned error: 403 Forbidden
14:21:00 Failure (22) Retrying in 1 seconds...
14:21:01 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/download/plugins/github-branch-source/1.10/github-branch-source.hpi -o /usr/share/jenkins/ref/plugins/github-branch-source.jpi)
Downloading plugin: github-branch-source-plugin from https://updates.jenkins.io/download/plugins/github-branch-source-plugin/1.10/github-branch-source-plugin.hpi
14:21:01 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/download/plugins/dashboard-view/2.9.10/dashboard-view.hpi -o /usr/share/jenkins/ref/plugins/dashboard-view.jpi)
Downloading plugin: dashboard-view-plugin from https://updates.jenkins.io/download/plugins/dashboard-view-plugin/2.9.10/dashboard-view-plugin.hpi
curl: (22) The requested URL returned error: 403 Forbidden
14:21:01 Failure (22) Retrying in 1 seconds...
14:21:01 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/download/plugins/statusmonitor/1.3/statusmonitor.hpi -o /usr/share/jenkins/ref/plugins/statusmonitor.jpi)
Downloading plugin: statusmonitor-plugin from https://updates.jenkins.io/download/plugins/statusmonitor-plugin/1.3/statusmonitor-plugin.hpi
14:21:01 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/download/plugins/ssh-agent/1.8/ssh-agent.hpi -o /usr/share/jenkins/ref/plugins/ssh-agent.jpi)

【问题讨论】:

  • 你可以访问这个地址https://updates.jenkins.io/download/plugins/structs-plugin/1.5/structs-plugin.hpi吗?
  • 是的。插件 URL 不正确。正确的 URL 是 https://updates.jenkins.io/download/plugins/structs/1.5/structs.hpi,但现在得到不同的错误 [/usr/share/jenkins/ref/plugins/plugins/copyartifact.jpi] End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive.
  • 您需要确保在构建 docker 镜像时可以访问互联网。这意味着请检查代理出站连接是否正常。
  • 确保您的代理允许连接

标签: docker jenkins jenkins-docker


【解决方案1】:

我使用你的 Dockerfile 来构建镜像,没有代理,它工作正常。我使用了一些在您的输出中编写的插件。所以,你的 Dockerfile 没问题,这个问题可能是代理。

这很容易评估。在下载带/不带代理的插件时尝试构建这个/另一个图像。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-18
    • 1970-01-01
    • 2015-06-02
    • 1970-01-01
    • 1970-01-01
    • 2016-07-22
    相关资源
    最近更新 更多