How to dockerize jenkins in the right way ?

32 views
Skip to first unread message

Narahari 'n' Savitha

unread,
Sep 21, 2018, 12:03:53 AM9/21/18
to Jenkins Users
Thank you folks in advance for your time and help.

Need some input please.
I used Dockerfile to pull lts-alpine
I then  installed requisites for ansible and installed ansible.
I ran container and mapped a volume so the jenkins home is shared with host.
It all works.
Now I can put jobs there from jenkins where we backup the config.xml.

Now for some best practice questions help please

I plan to setup Jenkins the way I want to (docker exec update plugins, jobs from git etc.,)
Re start container but mount host to a /tmp/jenkins folder inside container.
cp -Rf /tmp/jenkins /var/jenkins_home
Stop container and docker commit the image.

Start container with new image.  This way the image is completely self contained.
What do you folks think ?  Is this a good idea ?
I plan to update the cmd in the Dockerfile to use git to update jobs from git at startup or I can keep the latest job in the docker image.
I am in confusion.  Kindly advise.

-Narahari

Baptiste Mathus

unread,
Sep 21, 2018, 5:52:04 PM9/21/18
to jenkins...@googlegroups.com
Do not mount data from the host. It's called a bind-mount and is generally strongly discouraged.

Not sure what is your purpose *exactly*.

To store data and be able to upgrade,I have written https://batmat.net/2018/09/07/how-to-run-and-upgrade-jenkins-using-the-official-docker-image/ recently.

For the things like plugins, IIUC your use case: read the image documentation and derive the official image by installing additional plugins.

Cheers


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7a8fe5a7-90b3-481e-84c9-fb6a3897966e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages