BM: Baca dalam Bahasa Melayu
World D6: Under the Hood
The overlay filesystem
You will learn: how many containers share one image, each writing on its own thin top layer.
Checked with Docker Engine 29 on 31 Oct 2026
The problem
Ten lunchboxes start from one alpine meal pack. How much disk do they need?
Pick one answer.
Watch
Your laptop~
- No open hatches
Lunchboxes (containers)
- box1running
- box2running
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
2 containers (2 running), 1 images, 0 lockers.
One image, two boxes, tiny extra disk. The image layers are read-only kek lapis. Each box gets a clear sheet on top. That stack is the overlay filesystem: Read-only image layers with one thin writable sheet on top for each container. Many containers share one image..
Try it
box1 wrote a note on its sheet. Can box2 read it? Type docker exec box2 cat /root/note.txt.
Your laptop~
- No open hatches
Lunchboxes (containers)
- box1running
- box2running
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
2 containers (2 running), 1 images, 0 lockers.
Hint
docker exec box2 cat /root/note.txt reads the file inside box2.Predict
box1 edits /etc/profile, a file from the image. Where does the change go?
Pick one answer.
Check
docker diff reads the top sheet. A = added, C = changed, D = deleted. A delete leaves a hiding sticker, called a whiteout. The image still has the file.
Check
Good habit, or needs work?
Swipe right for good, left for needs work. Or use the buttons.
Keep database files in a volume, not on the top sheet.
You did it!
You can now explain how containers share one image.
Go deeper (optional)
In OverlayFS words: image layers are lowerdir, the sheet is upperdir, and the box sees merged. Fresh Docker Engine 29 installs use the containerd image store with its overlayfs snapshotter. Upgraded older installs may say overlay2. Check with docker info.
Real mission
docker run -d --name box alpine:3.22 sleep 300docker exec box sh -c "echo hi > /root/note.txt"docker diff boxdocker rm -f box
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Sepuluh bekas bermula dari satu pek makanan alpine. Berapa banyak ruang cakera yang diperlukan?
Satu image, dua bekas, ruang tambahan yang kecil. Lapisan image ialah kek lapis baca sahaja. Setiap bekas dapat plastik lutsinar di atas. Susunan itu ialah overlay filesystem (sistem fail overlay).
box1 tulis nota pada plastiknya. Boleh box2 baca? Taip docker exec box2 cat /root/note.txt.
docker exec box2 cat /root/note.txt baca fail itu di dalam box2.box1 ubah /etc/profile, satu fail dari image. Ke mana perubahan itu pergi?
docker diff baca plastik atas. A = ditambah, C = diubah, D = dipadam. Padam tinggalkan pelekat penyorok, dipanggil whiteout. Image masih ada fail itu.
Tabiat baik, atau perlu diperbaiki?
Kini anda boleh terangkan cara container kongsi satu image.
You finished this before. Practice is always welcome!
Official docs: OverlayFS storage driver · containerd image store · docker container diff
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?