5

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

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
2
  • Are you looking to install them locally, over the web, or from either?
    – Preston Martin
    May 6, 2019 at 21:43
  • Either way, preferably through the web tho May 6, 2019 at 22:48

1 Answer 1

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.

1
  • 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 May 22, 2019 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.