简体   繁体   中英

How to add Jenkins plugins on docker container deployment?

I am running a docker container that contains Jenkins. The docker image I am using is the latest that docker provides.

The container runs and I can access the GUI when I deploy;

docker run -d -p 8080:8080 --name=jenkins-master jenkins/jenkins

However. when I try to add plugins from the front end, there doesn't seem to be a list available. I need to have the pipeline plug in for my JenkinsFile.

Is there anyway to to declare the use of plugins when deploying the container?

I am working in an environment that does not have internet access so plugins would have to be added when the container is being built.

Thanks

You can try this image this image contains all the necessary plug-in.

docker run --rm --name jenkins -p 8080:8080 -p 50000:50000 adilm7177/jenkins-with-plug-in

You can check the description of this image. A list of plugin mention on the page.

jenkins-with-plug-in

If you want to build your own image then try this

 docker cp jen:/var/jenkins_home/ ./jenkin_plugin

then create dockerfile, build it and it run so you don't need plugin every time.

FROM jenkins/jenkins:alpine
COPY jenkin_plugin /var/jenkins_home
ENTRYPOINT [ "/usr/local/bin/jenkins.sh" ]

I ended up creating my own image from a Dockerfile in Dev. Then I deployed it to the internet restricted environment.

FROM jenkins/jenkins:lts
# if we want to install via apt
USER root
RUN apt-get update && apt-get install -y ruby make
# drop back to the regular jenkins user - good practice
USER jenkins
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt*

In the plugins.txt file I provided a list of plugins I would like to be installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM