Installing Jenkins Plugins to Docker Jenkins


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

FROM jenkins
USER root
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

I’m trying to install some additional plugins but it gives me an error saying no such file or directory
enter image description here

I then started and connected to the container of this build step in order to “debug” the error:
enter image description here

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

However, this is the wrong place as they have to be placed in the directory $JENKINS_HOME/plugins

Why I am not able to install the plugins in $JENKINS_HOME/plugins?


I can’t read your screenshots, but you don’t seem to be following the official instructions. See under “Installing more tools”. Note:

  • 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 script. This looks like:
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/ < /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.

Answered By – Adrian Mouat

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published