2016-09-30 44 views
1

我有一個Dockerfile自定義詹金斯大師像這樣:當碼頭工人的插件建設詹金斯無法安裝

FROM jenkins 
MAINTAINER me 

USER root 

RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state 

RUN apt-get update \ 
     && apt-get install -y sudo \ 
     && apt-get install -y vim \ 
     && rm -rf /var/lib/apt/lists/* 
RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers 

USER jenkins 

# COPY plugins.txt /usr/share/jenkins/plugins.txt 
# RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt 
ENV JAVA_OPTS="-Xmx8192m" 
ENV JENKINS_OPTS="--handlerCountStartup=100 --handlerCountMax=300" 


RUN /usr/local/bin/install-plugins.sh git:2.6.0 

一切工作正常,直到RUN /usr/local/bin/install-plugins.sh git:2.6.0線。我在安裝插件時遇到錯誤:

Creating initial locks... 

Analyzing war... 

Downloading plugins... 
Downloading plugin: git from https://updates.jenkins.io/download/plugins/git/2.6.0/git.hpi 
Downloading plugin: git-plugin from https://updates.jenkins.io/download/plugins/git-plugin/2.6.0/git-plugin.hpi 
Failed to download plugin: git or git-plugin 

WAR bundled plugins: 


Installed plugins: 
*: 

Some plugins failed to download! 
Not downloaded: git 
The command '/bin/sh -c /usr/local/bin/install-plugins.sh git:2.6.0' returned a non-zero code: 1 

我在做什麼錯誤或者這是Jenkins/Docker的問題?

回答

1

你Dockerfile工作對我來說,安裝的所有插件和成功生成圖像:

Analyzing war... 
Downloading plugins... 
Downloading plugin: git from https://updates.jenkins.io/download/plugins/git/2.6.0/git.hpi 
> git depends on workflow-scm-step:1.14.2,mailer:1.17,matrix-project:1.7.1,ssh-credentials:1.12,parameterized-trigger:2.4;resolution:=optional,scm-api:1.2,token-macro:1.11;resolution:=optional,promoted-builds:2.27;resolution:=optional,credentials:2.1.4,git-client:1.21.0 

Downloading plugin: workflow-scm-step from https://updates.jenkins.io/download/plugins/workflow-scm-step/latest/workflow-scm-step.hpi 
... 
Removing intermediate container 4f895c203944 
Successfully built 31d58d1f586f 

嘗試docker build --no-cache的情況下,有一個與你的圖片緩存,圖層的一個問題,或者設置一個automated build on Docker Hub和構建它在Docker的服務器上。

+0

那麼它的工作就泊塢樞紐,謝謝。我不會想到的嘗試此。必須是一些與我的本地環境。我使用docker for mac。 – rainkinz

1

我記得自己安裝該腳本時遇到問題。相反,我用了以下內容:

RUN install-plugins.sh \ 
    disable-failed-job \ 
    disk-usage \ 
    greenballs \ 
    ... 

,希望這不會有所作爲的,但我有我的插件安裝我Dockerfile的根部內側,又降至運行命令爲USER jenkins之前。

+0

致謝片段,但不幸的是,它似乎沒有它:-( – rainkinz

0

我不得不在OS X同樣的問題

在我的情況下,問題是由DNS配置錯誤(由DHCP獲得)造成的。當我將DNS更改爲Google的DNS 8.8.8.8時,它一切正常。

我遇到如下錯誤消息: 未能解析主機名「ftp.icm.edu.pl」。也許你需要配置HTTP代理

0

我有一個非常類似的問題,我的解決方案是在插件安裝之前在Docker文件中指定代理。下面是我Dockerfile

FROM jenkins:latest 
MAINTAINER Jose Estrada 
USER root 
ENV JAVA_OPTS="--handlerCountStartup=100 --handlerCountMax=300 --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war -Dhttps.proxyHost=proxy-wsa.esl.cisco.com -Dhttps.proxyPort=80" 
ENV http_proxy <PROXY Settings> 
ENV https_proxy <PROXY Settings> 
RUN /usr/local/bin/install-plugins.sh cisco-spark-notifier:latest