为什么Docker需要Union File System [英] Why does Docker need a Union File System

查看:331
本文介绍了为什么Docker需要Union File System的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Docker对Union File系统(如AUFS)做什么来创建容器?如果Docker不得不使用常规文件系统而不是联合文件系统会有什么不利之处?



我正在寻找具体的技术细节/内部,而不是高级别

解决方案

它用于:




  • 避免在每次以新容器运行图像时复制一组完整的文件。

  • 将更改分隔为其自身层中的容器文件系统,允许将同一容器置于从已知内容重新启动(因为在删除容器时,更改的图层将被关闭)



UnionFS


实现功能安装用于其他文件系统。它允许单独文件系统的文件和目录(称为分支)透明地覆盖,形成单个一致的文件系统。

在合并的分支中具有相同路径的目录的内容将一起显示在一个单一的合并目录,在新的虚拟文件系统中。



这允许文件系统显示为可写,但实际上不允许写入更改文件系统,也称为作为 写时复制


如果您没有UnionFS,则运行5次5分的容器的200MB映像分隔容器将意味着1GB的磁盘空间。



请参阅 Docker图像如何工作?

有关更多技术细节,请参阅:




What exactly does Docker do with Union File system (like AUFS) to create the containers ? If Docker had to use a regular file system instead of a union file system what will be the disadvantages ?

I am looking for specific technical details/internals and not a high level answer.

解决方案

It is used to:

  • avoid duplicating a complete set of files each time you run an image as a new container
  • isolate changes to a container filesystem in its own layer, allowing for that same container to be restarted from a known content (since the layer with the changes will have been dismissed when the container is removed)

That 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

If you didn't have UnionFS, an 200MB image run 5 times as 5 separates containers would mean 1GB of disk space.

See more at "How does a Docker image work?".
For more technical details, see:

这篇关于为什么Docker需要Union File System的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆