- Getting Started with Kubernetes
- Jonathan Baier Jesse White
- 445字
- 2021-06-10 19:46:57
Union filesystems
Union filesystems are also a key advantage of using Docker containers. Containers run from an image. Much like an image in the VM or cloud world, it represents state at a particular point in time. Container images snapshot the filesystem, but tend to be much smaller than a VM. The container shares the host kernel and generally runs a much smaller set of processes, so the filesystem and bootstrap period tend to be much smaller—though those constraints are not strictly enforced. Second, the union filesystem allows for the efficient storage, download, and execution of these images. Containers use the idea of copy-on-write storage, which is able to create a brand new container immediately, without having to wait on copying out a whole new filesystem. This is similar to thin provisioning in other systems, where storage is allocated as needed:

Copy-on-write storage keeps track of what's changed, and in this way is similar to distributed version control systems (DVCS) such as Git. There are a number of options available to the end user that leverage copy-on-write storage:
- AUFS and overlay at the file level
- Device mapper at the block level
- BTRFS and ZFS and the filesystem level
The easiest way to understand union filesystems is to think of them like a layer cake with each layer baked independently. The Linux kernel is our base layer; then, we might add an OS such as Red Hat Linux or Ubuntu.
Next, we might add an application such as nginx or Apache. Every change creates a new layer. Finally, as you make changes and new layers are added, you'll always have a top layer (think frosting) that is a writable layer. Union filesystems leverage this strategy to make each layer lightweight and speedy.
In Docker's case, the storage driver is responsible for stacking these layers on top of each other and providing a single pane of glass to view these systems. The thin writable layer on the top of this stack of layers is where you'll do your work: the writable container layer. We can consider each layer below to be container image layers:

What makes this truly efficient is that Docker caches the layers the first time we build them. So, let's say that we have an image with Ubuntu and then add Apache and build the image. Next, we build MySQL with Ubuntu as the base. The second build will be much faster because the Ubuntu layer is already cached. Essentially, our chocolate and vanilla layers, from the preceding diagram, are already baked. We simply need to bake the pistachio (MySQL) layer, assemble, and add the icing (the writable layer).
- 電氣自動化專業英語(第3版)
- Mastering Spark for Data Science
- LabVIEW虛擬儀器從入門到測控應用130例
- 人工智能超越人類
- 蕩胸生層云:C語言開發修行實錄
- MCSA Windows Server 2016 Certification Guide:Exam 70-741
- 工業機器人工程應用虛擬仿真教程:MotoSim EG-VRC
- Associations and Correlations
- 基于32位ColdFire構建嵌入式系統
- 空間站多臂機器人運動控制研究
- 教育機器人的風口:全球發展現狀及趨勢
- 統計挖掘與機器學習:大數據預測建模和分析技術(原書第3版)
- 學練一本通:51單片機應用技術
- 手機游戲策劃設計
- 空間機器人智能感知技術