简体   繁体   中英

Saving docker container image

I created a new docker container using jenkings image

This is the command I ran

docker run -p 8080:8080 -v /var/jenkins_home jenkins

I created a few jobs on the jenkins instance and commited the image

docker commit 7b903d061654 test

When I run the image I created using the command (below) I dont see the jenkins jobs below

docker run -p 8080:8080 -v /var/jenkins_home test

Am I missing anything here ? I was expecting the jenkins jobs I have created to be saved

How do I persist changes and distribute images ?

Data in a Docker volume (such as /var/jenkins_home ) is not preserved as part of the docker commit operation. This is intentional -- the idea is that you are persisting you data via some other mechanism, such as a host volume ( -v /host/directory:/var/jenkins_home ) or through the use of a data container (using --volumes-from ).

For more information about Docker volumes, see Managing data in containers .

Volumes are used in this fashion to keep data seperate from your applications. This permits you to save large data into volumes without baking it into your images when you run docker commit , or similarly to store security credentials or other private data in the volume without accidentally leaking it into an image that you intent to distribute.

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