乐闻世界logo
搜索文章和话题

What is the working principle of Docker container file system?

2月17日 23:45

Docker container file system is a layered storage structure composed of multiple read-only layers and one read-write layer. Read-only layers come from the image, while the read-write layer (container layer) is used to store runtime modifications. When a container reads a file, it searches from top to bottom across layers; when a container writes to a file, it uses the Copy-on-Write mechanism, copying the file from the read-only layer to the read-write layer before modification. When deleting a file, a whiteout file is created in the read-write layer to mark the deletion. This design allows multiple containers to share the same image layers, saving storage space. After a container stops, the read-write layer remains unless the --rm parameter is used to delete the container.

标签:Docker