案例库 · 工程与运营 · 技术决策 · 2014–2015
这条还没译成中文,下面是英文原文。
Docker image layers share storage until a container writes, then copy
OverlayFS lets many containers share one read-only image and, thanks to copy-on-write, only copies a file when a container actually modifies it.
Docker / OverlayFS
那一手
Running many containers from the same base image naively stores the whole image once per container, which is wasteful for frameworks and servers that share an identical large base.
OverlayFS solves it by layering. The base image is kept read-only as the lower layer; each container adds a small writable upper layer. Reads go to the lower layer, and when a container modifies a file, the driver copies the affected data up and writes there.
Because of copy-on-write, the shared base stays shared until an actual write forces a copy, so the storage cost is proportional to what each container changes rather than to the full image size, and start-up stays cheap on the same shared blocks.
为什么管用
- A single shared read-only base is reused across many containers.
- Copy-on-write means only modified data is duplicated.
- Pull and start-up stay cheap because most layers are identical and shared.
可以搬走什么
If many processes use the same unchanged resource, share it by default and pay to copy only at the moment of modification; that turns a per-process cost into a per-change cost.
后来呢
OverlayFS became a default storage driver for Docker, and copy-on-write layering became the basis of how containerised workloads move and store images in production.
资料来源
发现哪里写错了?告诉我们。