dotcloud/docker — pull request #4127 by alexlarsson (2014-02-13 19:15:35+00:00)
Title: Add overlayfs backend

This backend uses the overlayfs union filesystem for containers
plus hard link file sharing for images.

Each container/image can have a "root" subdirectory which is a plain
filesystem hierarchy, or they can use overlayfs.

If they use overlayfs there is a "rw" directory and a "rw-parent"
file, as well as an "overlay" directory. The "rw" directory has the
upper layer of the overlay, and "rw-parent" contains the id of the
parent whose "root" directory shal be used as the lower layer in the
overlay. The overlay itself is mounted in the "overlay" directory.

When a overlay layer is created there are two cases, either the
parent has a "root" dir, then we start out with a empty "rw"
directory overlaid on the parents root. This is typically the
case with the $container-init layer which is based on an image.
If there is no "root" in the parent, we inherit the rw-root from
the parent and start by making a copy if the parents "rw" dir.
This is typically the case for a container layer which copies
its parent -init rw layer.

Additionally we also have a custom implementation of ApplyLayer
which makes a recursive copy of the parent "root" layer using
hardlinks to share file data, and then applies the layer on top
of that. This means all images share file (but not directory)
data.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson (github: alexlarsson)