我应该在提交之前停止容器吗?
Should I stop a container before commit it?
在大多数教程中,他们会在提交之前停止容器。
例如:https://docs.oracle.com/cd/E52668_01/E54669/html/section_c5q_n2z_fp.html
有一次我忘记在提交之前停止它。但是提交仍然成功完成!不知道有没有隐藏的损坏。
默认情况下,docker 会在提交期间自动暂停容器,以确保它以一致的状态提交容器,因此提交 运行 容器应该不是问题; from the docs:
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.
If this behavior is undesired, set the ‘p’ option to false.
user guide 有话要说:
When you commit your container, Docker only stores the diff (difference) between the source image and the current state of the container’s image. To list images you already have, use the docker images
command.
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. If this behavior is undesired, set the 'p' option to false.
我的解释是,虽然可能会发生损坏,但假设您没有使用 'p' 选项,则不太可能。
在大多数教程中,他们会在提交之前停止容器。 例如:https://docs.oracle.com/cd/E52668_01/E54669/html/section_c5q_n2z_fp.html
有一次我忘记在提交之前停止它。但是提交仍然成功完成!不知道有没有隐藏的损坏。
默认情况下,docker 会在提交期间自动暂停容器,以确保它以一致的状态提交容器,因此提交 运行 容器应该不是问题; from the docs:
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. If this behavior is undesired, set the ‘p’ option to false.
user guide 有话要说:
When you commit your container, Docker only stores the diff (difference) between the source image and the current state of the container’s image. To list images you already have, use the
docker images
command.
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. If this behavior is undesired, set the 'p' option to false.
我的解释是,虽然可能会发生损坏,但假设您没有使用 'p' 选项,则不太可能。