What is exactly happening when you're Docker Commiting a container?

南楼画角 提交于 2019-12-01 11:29:09

问题


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?


回答1:


As mentioned in docker commit:

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.

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

You can see the actual commit call in api/server/router/image/image_routes.go#postCommit() which is then routed through a backend to daemon/commit.go#Commit()



来源:https://stackoverflow.com/questions/37904599/what-is-exactly-happening-when-youre-docker-commiting-a-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!