title: Installing Jenkins Plugins to Docker Jenkins
body: <p>I have the following Dockerfile with <code>jenkins</code> as the base image: </p>
  
  <pre><code>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
  </code></pre>
  
  <p>I'm trying to install some additional plugins but it gives me an error saying <code>no such file or directory</code>
  <img src="https://i.stack.imgur.com/HkCdJ.png" alt="enter image description here"></p>
  
  <p>I then started and connected to the container of this build step in order to "debug" the error:
  <img src="https://i.stack.imgur.com/fI3Bu.png" alt="enter image description here"></p>
  
  <p>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...</p>
  
  <p>I further noticed, that the installation of the the plugins works, if I install them in the root directory as follows:</p>
  
  <pre><code>RUN for plugin in git-client git ws-cleanup ; do wget -O ${plugin}.hpi $JENKINS_MIRROR/plugins/${plugin}/latest/${plugin}.hpi ; done
  </code></pre>
  
  <p>However, this is the wrong place as they have to be placed in the directory $JENKINS_HOME/plugins</p>
  
  <p>Why I am not able to install the plugins in <code>$JENKINS_HOME/plugins</code>?</p>