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

标签 docker filesystems containers

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/

相关文章:

mysql - Docker + Mysql 连接错误 : Unknown MySQL server host 'db'

spring - 如何将Spring Boot RESTful Web服务Docker镜像部署到EC2?

php - 如何在 nginx 反向代理后面将 XDebug 与 PHP 上游一起使用?

用于快速存储文件/BLOB 的 SQL 或文件系统?

c# - 哪种 C# 容器对于仅存在一个操作的资源效率最高?

go - docker 命令行列表参数

php - 消息系统,存储在数据库中还是文件系统中更好?

c++ - 使用多个 "." boost 文件扩展名

C++ mt19937 总是给出相同的数字,即使在播种时也是如此

html - 如何在响应模式下垂直居中 3 div(移动与桌面)