Answers: <p>This seems to be the right idea: <a href="https://stackoverflow.com/questions/29328278/installing-jenkins-plugins-to-docker-jenkins/29328489#29328489">https://stackoverflow.com/questions/29328278/installing-jenkins-plugins-to-docker-jenkins/29328489#29328489</a></p>
  
  <p>so in the Dockerfile you'd just use:</p>
  
  <pre><code>COPY plugins.txt /usr/share/jenkins/plugins.txt
  RUN /usr/local/bin/install-plugins.sh &lt; /usr/share/jenkins/plugins.txt
  </code></pre>
  
  <p>I tried it and it worked for me.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-05-22T22:56:42.353Z
Answers: You can also have the plugins in the RUN command, separated by spaces: `RUN /usr/local/bin/install-plugins.sh plugin-1 plugin-2 plugin-N`
Answers: Joao Coelho
Answers: CC BY-SA 4.0
Answers: 2019-05-07T18:38:38.343Z
Answers: 2019-05-07T18:38:38.343Z
Answers: Alexander Mills
Body: <p>If I have a jenkins docker image:</p>
  
  <pre><code>FROM jenkins/jenkins:lts
  </code></pre>
  
  <p>is there a way to pre-install certain plugins using the Docker image, for example all the bitbucket plugins:</p>
  
  <p><kbd>
  <a href="https://i.sstatic.net/WPa9x.png" rel="noreferrer"><img src="https://i.sstatic.net/WPa9x.png" alt="enter image description here"></a>
  </kbd></p>
  
  <p>I assume we'd probably have to unpack some tars to the filesystem somewhere like so:</p>
  
  <pre><code> FROM jenkins/jenkins:lts
  
   USER root
  
   WORKDIR /jenkins/main/dir
  
   RUN tar -xvf some-jenkins-plugins.tar
  </code></pre>
  
Comments: CC BY-SA 4.0
Comments: 2019-05-06T21:43:27.190Z
Comments: Are you looking to install them locally, over the web, or from either?
Comments: Preston Martin
Comments: CC BY-SA 4.0
Comments: 2019-05-06T22:48:14.383Z
Comments: Either way, preferably through the web tho
Comments: Alexander Mills
Tags: <docker><jenkins>
Title: Pre-install Jenkins plugins using Docker image
UserDisplayName: Alexander Mills
ThreadText: # Pre-install Jenkins plugins using Docker image
  
  (Asked by: username_0 on 2019-05-06)
  
  If I have a jenkins docker image:
  
  ```
  FROM jenkins/jenkins:lts
  
  ```
  
  is there a way to pre-install certain plugins using the Docker image, for example all the bitbucket plugins:
  
  `![enter image description here](https://i.sstatic.net/WPa9x.png)`
  
  I assume we'd probably have to unpack some tars to the filesystem somewhere like so:
  
  ```
   FROM jenkins/jenkins:lts
  
   USER root
  
   WORKDIR /jenkins/main/dir
  
   RUN tar -xvf some-jenkins-plugins.tar
  
  ```
  
  **Tags:** docker, jenkins
  
  > **Comments:**
  > **username_1**: Are you looking to install them locally, over the web, or from either?  
  > **username_0**: Either way, preferably through the web tho  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-05-07. Score: 2
  
  This seems to be the right idea: <https://stackoverflow.com/questions/29328278/installing-jenkins-plugins-to-docker-jenkins/29328489#29328489>
  
  so in the Dockerfile you'd just use:
  
  ```
  COPY plugins.txt /usr/share/jenkins/plugins.txt
  RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/plugins.txt
  
  ```
  
  I tried it and it worked for me.
  
  > **Comments:**
  > **username_2**: You can also have the plugins in the RUN command, separated by spaces: `RUN /usr/local/bin/install-plugins.sh plugin-1 plugin-2 plugin-N`  
  
  ---
  
  