github.com/feiyang21687/docker@v1.5.0/docs/sources/terms/layer.md (about)

     1  page_title: Layers
     2  page_description: Organizing the Docker Root File System
     3  page_keywords: containers, lxc, concepts, explanation, image, container
     4  
     5  # Layers
     6  
     7  ## Introduction
     8  
     9  In a traditional Linux boot, the kernel first mounts the root [*File
    10  System*](/terms/filesystem) as read-only, checks its
    11  integrity, and then switches the whole rootfs volume to read-write mode.
    12  
    13  ## Layer
    14  
    15  When Docker mounts the rootfs, it starts read-only, as in a traditional
    16  Linux boot, but then, instead of changing the file system to read-write
    17  mode, it takes advantage of a [union
    18  mount](http://en.wikipedia.org/wiki/Union_mount) to add a read-write
    19  file system *over* the read-only file system. In fact there may be
    20  multiple read-only file systems stacked on top of each other. We think
    21  of each one of these file systems as a **layer**.
    22  
    23  ![](/terms/images/docker-filesystems-multilayer.png)
    24  
    25  At first, the top read-write layer has nothing in it, but any time a
    26  process creates a file, this happens in the top layer. And if something
    27  needs to update an existing file in a lower layer, then the file gets
    28  copied to the upper layer and changes go into the copy. The version of
    29  the file on the lower layer cannot be seen by the applications anymore,
    30  but it is there, unchanged.
    31  
    32  ## Union File System
    33  
    34  We call the union of the read-write layer and all the read-only layers a
    35  **union file system**.