Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commit to jenkins docker image does not save changes

Tags:

docker

jenkins

I pull the official Jenkins docker image from here. From Jenkins UI I create a new job , install the github plugin and set the repo urls in the job configuration.

Finally I save the changes from Jenkins.

I want to create a new image as it is. I stop the container, and commit it to a new image.

Then I start a new container from the new image...and Jenkins does not contain any of my changes.

I use Docker version 1.6.2, build 7c8fca2

like image 477
Kostas Demiris Avatar asked Oct 30 '15 19:10

Kostas Demiris


People also ask

Do Docker containers Save changes?

Hence, if you want the changes to persist, you can use the Docker commit command. The commit command will save any changes you make to the container and create a new image layer on top of it.

How do I save Docker credentials in Jenkins?

Manage Jenkins → Manage Plugins In Jenkins you have to add a new credential with your Docker Hub account details. Go to Credentials → Global → Add credentials and fill out the form with your username and password.

Does Docker stop save state?

That's why its ideal to have to changes in docker file and in short, there is no save state feature in docker system like we have in virtual machines. The memory contents are always lost. Save this answer.


1 Answers

The Dockerfile declares the jenkins home directory as a volume

# Jenkins home directoy is a volume, so configuration and build history 
# can be persisted and survive image upgrades
VOLUME /var/jenkins_home

This means all changes to the Jenkins configuration is made outside of the docker image.

Update

The project README describes how to create your own derivative docker images with plugins pre-installed.

  • https://github.com/jenkinsci/docker/blob/master/README.md

For example

FROM jenkins
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt
like image 64
Mark O'Connor Avatar answered Oct 22 '22 16:10

Mark O'Connor