layer.rst 1.4 KB

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