<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>

CC BY-SA 4.0
2019-05-22T22:56:42.353Z
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`
Joao Coelho
CC BY-SA 4.0
2019-05-07T18:38:38.343Z
2019-05-07T18:38:38.343Z
Alexander Mills
<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>

CC BY-SA 4.0
2019-05-06T21:43:27.190Z
Are you looking to install them locally, over the web, or from either?
Preston Martin
CC BY-SA 4.0
2019-05-06T22:48:14.383Z
Either way, preferably through the web tho
Alexander Mills
<docker><jenkins>
Pre-install Jenkins plugins using Docker image
Alexander Mills
# 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:



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`  

---

