mkdir -v lowerdir upperdir workdir overlay
sudo tree
.
├── lowerdir
├── overlay
├── upperdir
└── workdir
lowerdir layer (read only, base layer)
overlay layer (main view)
work layer (diff view, diff layer )
sudo mount -t overlay -o lowerdir=lowerdir,upperdir=upperdir,workdir=workdir overlay overlay
echo test > lowerdir/test
sudo tree
.
├── lowerdir
│ └── test
├── overlay
│ └── test
├── upperdir
└── workdir
└── work
echo 'some new data' >> overlay/test
sudo tree
.
├── lowerdir
│ └── test
├── overlay
│ └── test
├── upperdir
│ └── test
└── workdir
└── work
This is principe how docker is working.