[英]Saving docker container image
I created a new docker container using jenkings image 我使用詹金斯镜像创建了一个新的Docker容器
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 我在jenkins实例上创建了一些作业,并提交了映像
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. Docker卷中的数据(例如
/var/jenkins_home
) 未保留为/var/jenkins_home
docker commit
操作的一部分。 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
). 这是有意的-想法是您通过某种其他机制(例如主机卷(
-v /host/directory:/var/jenkins_home
))或通过使用数据容器(使用--volumes-from
来--volumes-from
数据。 --volumes-from
)。
For more information about Docker volumes, see Managing data in containers . 有关Docker卷的更多信息,请参阅管理容器中的数据 。
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. 这允许您将大型数据保存到卷中,而无需在运行
docker commit
时将其烘焙到映像中,或者类似地将安全凭据或其他私有数据存储在卷中,而不会意外将其泄漏到要分发的映像中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.