
Here's a preview from my zine, How Containers Work!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

read the transcript!
how layers work: mount -t overlay
smiling stick figure with curly hair: can you combine these 37 layers into one filesystem?
linux, represented by Tux the penguin: yes! Just run mount —t overlay
with the right parameters!
mount -t overlay
has 4 parameters
lowerdir
: list of read-only directoriesupperdir
: directory where writes should goworkdir
: empty directory for internal usetarget
: the merged result
upperdir
: where all writes go
when you create, change, or delete a file, it’s recorded in the upperdir.
usually this starts out empty and is deleted when the container exits
lowerdir: the layers. read only.
smiling stick figure with curly hair: you can run $ mount -t overlay
inside a container to gee all the lower dirs that were combined to create its filesystem!
here’s an example!
$ mount -t overlay overlay -o
lowerdir=/lower , upperdir=/upper , workdir=/work /merged
$ ls /upper
cat.txt dog.txt
$ ls /lower
dog. txt bird.txt
$ ls /merged
cat.txt dog.txt bird.txt
the merged version of dog.txt is the one from the upper directory
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!