gpt4 book ai didi

docker - 为什么 Docker 需要联合文件系统

转载 作者:IT老高 更新时间:2023-10-28 12:37:52 24 4
gpt4 key购买 nike

Docker 究竟如何使用联合文件系统(如 AUFS)来创建容器?如果 Docker 必须使用常规文件系统而不是联合文件系统,会有什么缺点?

我正在寻找具体的技术细节/内部信息,而不是高水平的答案。

最佳答案

用于:

  • 避免每次将镜像作为新容器运行时都复制一组完整的文件
  • 在其自己的层中隔离对容器文件系统的更改,从而允许从已知内容重新启动同一个容器(因为当容器被移除时,具有更改的层将被解除)

那个 UnionFS :

implements a union mount for other file systems. It allows files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system.
Contents of directories which have the same path within the merged branches will be seen together in a single merged directory, within the new, virtual filesystem.

This allows a file system to appear as writable, but without actually allowing writes to change the file system, also known as copy-on-write

如果您没有 UnionFS,一个 200MB 的镜像运行 5 次,因为 5 个独立的容器将意味着 1GB 的磁盘空间。

在“How does a Docker image work?”上查看更多信息。
有关更多技术细节,请参阅:

关于docker - 为什么 Docker 需要联合文件系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32775594/

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