Skip to Content
Navigation:

A stick figure smiling

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!

Image of a comic. To read the full HTML alt text, click "read the transcript". get the zine!
read the transcript!

different images have similar files

Rails container image and Django container image: we both use Ubuntu 18.04!

reusing layers saves disk space

Rails image:
Rails app
ubuntu:18.04

Django image: Django app
ubuntu:18.04

exact same files on disk!

a layer is a directory

$ ls 8891378eb*
bin/home/mnt/run/tmp/
boot/lib/ opt sbin/ usr/ dev/lib64/proc/srv/var/
etc/media/ root/sys/

files in an ubuntu:18.04 layer

every layer has an ID

usually the ID is a sha256 hash of the layer’s contents example: 8e99fae2..

if a file is in 2 layers, you’ll see the version from the top layer

/code/file.py (this is the version you’ll see in the merged image) /code/file.py

by default, writes go to a temporary layer

temp layer (these files might be deleted after the container exits)

To keep your changes, write to a directory that’s mounted from outside the container