BM: Baca dalam Bahasa Melayu
World D1: First Containers
Clean up safely
You will learn: to see what fills your disk, and to clean up without losing what you need.
Checked with Docker Engine 29 on 31 Oct 2026
The problem
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- old1stopped
- old2stopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- hello-world:latest1 layers · 25.9kB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
- redis:8-alpine7 layers · 162MB
3 containers (1 running), 4 images, 0 lockers.
Your laptop is filling up. Old boxes and packs pile up, like a messy fridge. docker system df shows what uses the space.
Try it
docker rm throws away a stopped box, and the files inside it. Remove old1 and old2. Keep web.
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- old1stopped
- old2stopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- hello-world:latest1 layers · 25.9kB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
- redis:8-alpine7 layers · 162MB
3 containers (1 running), 4 images, 0 lockers.
Hint
docker rm old1 old2Watch
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- old1stopped
- old2stopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- hello-world:latest1 layers · 25.9kB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
- redis:8-alpine7 layers · 162MB
3 containers (1 running), 4 images, 0 lockers.
docker rmi removes a meal pack. redis goes. hello-world is refused: the real error says a container is using its referenced image. Plain words: remove the box first.
Predict
docker system prune asks: are you sure? What will y delete?
Pick one answer.
Watch
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- old1stopped
- old2stopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- hello-world:latest1 layers · 25.9kB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
- redis:8-alpine7 layers · 162MB
3 containers (1 running), 4 images, 0 lockers.
prune: Sweep away everything unused in one go. It asks first, and there is no undo. sweeps up everything unused. It always asks first. y deletes, and there is no undo. N keeps it all.
Try it
Safe to type any time, or careful? Sort them.
Drag a card into a box. Or tap the card, then tap the box.
Try it
Sweep up every stopped box in one go. Read the warning before you answer.
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- old1stopped
- old2stopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- hello-world:latest1 layers · 25.9kB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
- redis:8-alpine7 layers · 162MB
3 containers (1 running), 4 images, 0 lockers.
Hint
docker container prune, then y.You did it!
You can now free space without losing what you need.
Go deeper (optional)
Where the story breaks: you cook a real meal pack once. A Docker image is never used up: one pack fills endless boxes. Packs also share layers, so rmi may free less than you expect. Careful: docker volume prune -a deletes saved data (World D3).
Real mission
docker system dfdocker ps -adocker container prune
0 of 3 steps done · Your ticks are saved.
Bahasa Melayu
Laptop anda makin penuh. Bekas dan pek lama bertimbun, macam peti sejuk yang bersepah. docker system df tunjuk apa yang guna ruang.
docker rm buang bekas yang berhenti, bersama fail di dalamnya. Buang old1 dan old2. Simpan web.
docker rm old1 old2docker rmi buang pek beku. redis hilang. hello-world ditolak: ralat sebenar kata ada container is using its referenced image. Maksudnya: buang bekas itu dulu.
docker system prune tanya: anda pasti? Apa yang y akan padam?
Prune sapu semua yang tak digunakan. Ia sentiasa tanya dulu. y padam, dan tak boleh dibatalkan. N simpan semuanya.
Selamat ditaip bila-bila masa, atau perlu hati-hati? Susun.
Sapu setiap bekas yang berhenti sekali gus. Baca amaran sebelum anda jawab.
docker container prune, kemudian y.Kini anda boleh kosongkan ruang tanpa hilang apa yang anda perlukan.
You finished this before. Practice is always welcome!
Official docs: Prune unused Docker objects · docker system df · docker container rm · docker image rm · docker system prune
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?