gpt4 book ai didi

docker - 为什么我的 Docker 容器的可写层在容器退出后仍然存在?

转载 作者:行者123 更新时间:2023-12-02 18:06:09 25 4
gpt4 key购买 nike

Docker 的 storage overview文档说:

  • The data doesn’t persist when that container is no longer running, and it can be difficult to get the data out of the container if another process needs it.
  • A container’s writable layer is tightly coupled to the host machine where the container is running. You can’t easily move the data somewhere else.
  • Writing into a container’s writable layer requires a storage driver to manage the filesystem. The storage driver provides a union filesystem, using the Linux kernel. This extra abstraction reduces performance as compared to using data volumes, which write directly to the host filesystem.

如您所见,文档说,“当该容器不再运行时,数据不会持久存在”。那么为什么当我停止我的容器时数据没有被删除?

Action logs

最佳答案

如您所见和评论所证实的那样,数据确实保留在已停止的容器中。您可以重新启动容器并查看容器特定文件系统中的数据。您还可以使用 docker cp 从容器中提取这些文件。我已经提交了以下 documentation PR更新文档并消除任何混淆(感谢您指出措辞)。

关于docker - 为什么我的 Docker 容器的可写层在容器退出后仍然存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53333957/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com