Understanding how copy-on-write filesystems work
Building a container image is the first step that’s required when you develop an application using containers. In this chapter, we will learn about different methods to build images. But first, it will be interesting to deep dive into how images can be created in terms of filesystems.
Containers are processes that run isolated thanks to kernel features. They run on top of a host system with its own filesystem as if they were running completely independently within their own sub-system. Files included in this filesystem are grouped in different layers, one layer on top of another. Files that have to be modified from a lower layer are copied to the layer where the modification is going to be made, and these changes are then committed. New files are only created on the upper layer. This is the basis of copy-on-write (CoW) filesystems.
As we can expect with this model, the container runtime will manage all these changes. Every...