Overlay file systems are used by container systems like docker for saving disk space.
The “layers” we see as docker runs through every command of Dockerfile
is result of docker building another lower directory (possibly reusable) to the cascaded overlay file system used for a container.
Since container systems like docker use overlays, re-building an existing image with different tag doesn’t go through the build steps like installing packages again! :)
Union one lower directory and an upper directory:
Union multiple lower directories and one upper directory:
sudo mount -t overlay overlay -o lowerdir:./lower_1:./lower_2:./lower_3,upperdir=./upper,workdir=./parent ./parent
sudo mount -t overlay overlay -o lowerdir=./lower,upperdir=./upper,workdir=./parent ./parent