当你 Docker 提交一个容器时到底发生了什么? [英] What is exactly happening when you're Docker Commiting a container?

查看:26
本文介绍了当你 Docker 提交一个容器时到底发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,例如,当您使用 docker commit abcdefgh ola/minhaimagem:1.0 时,您会将 abcdefgh 容器中的更改保存到要使用的新映像中以后再说吧.但是,我注意到有时提交运行得很慢,这个事实在我脑海中产生了一个问题,提交运行时到底发生了什么?我的意思是,引擎盖下发生了什么?

I know that when you use, for example, docker commit abcdefgh ola/minhaimagem:1.0 you are saving your changes from the abcdefgh container into a new image to use it again futurely. However, i noticed that sometimes the commit runs very slow and that fact arised the question in my mind, what does exactly is happening while the commit is running? I mean, what is happening under the hood?

推荐答案

docker 提交:

默认情况下,正在提交的容器及其进程将在提交映像时暂停.这降低了在创建提交的过程中遇到数据损坏的可能性.

By default, the container being committed and its processes will be paused while the image is committed. This reduces the likelihood of encountering data corruption during the process of creating the commit.

该步骤(等待进程暂停)可能需要一些时间.

That step (waiting for the processes to pause) can take time.

如果不希望出现这种行为,请将 --pause 选项设置为 false.

If this behavior is undesired, set the --pause option to false.

您可以在 api/server/router/image/image_routes.go#postCommit() 然后通过后端路由到 daemon/commit.go#Commit()

这篇关于当你 Docker 提交一个容器时到底发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆