BM: Baca dalam Bahasa Melayu
World D1: First Containers
Container states: ps -a and inspect
You will learn: the states a container moves through, and how to read them.
Checked with Docker Engine 29 on 31 Oct 2026
The problem
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- jobstopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
2 containers (1 running), 2 images, 0 lockers.
You made two boxes: web and job. But docker ps shows only web. Where did job go?
Try it
docker ps lists running boxes only. Add -a to see all of them, stopped ones too.
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- jobstopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
2 containers (1 running), 2 images, 0 lockers.
Hint
Typedocker ps -a.Watch
A box has a life cycle: The states a container moves through: created, running, paused, exited, removed.. Each command moves it one step. Tap each step.
Tap each point on the timeline.
Try it
Freeze web with docker pause web. Then check docker ps. What does STATUS say?
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- jobstopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
2 containers (1 running), 2 images, 0 lockers.
Predict
job says Exited (0). Is that bad?
Pick one answer.
Watch
Your laptop~
- No open hatches
Lunchboxes (containers)
- webrunning
- jobstopped
Frozen packs (images)
- alpine:3.221 layers · 12.9MB · in use
- nginx:1.30-alpine8 layers · 93.5MB · in use
2 containers (1 running), 2 images, 0 lockers.
docker inspect reads the full label on a box. It holds every detail Docker knows. -f picks one line from it.
Check
True, or not quite? Swipe each card.
Swipe right for good, left for needs work. Or use the buttons.
docker ps shows stopped boxes too.
You did it!
You can now read a container’s state and spot a broken one.
Go deeper (optional)
Rarer states: restarting (a restart policy brings it back), removing and dead. docker ps --filter status=exited lists only stopped boxes. docker stop asks nicely, then forces the box after 10 seconds.
Real rep (optional):
Real mission
docker run -d --name web nginx:1.30-alpinedocker stop webdocker ps -adocker inspect -f '{{.State.Status}}' webdocker rm web
0 of 5 steps done · Your ticks are saved.
Bahasa Melayu
Anda buat dua bekas: web dan job. Tapi docker ps tunjuk web sahaja. Ke mana job pergi?
docker ps senaraikan bekas yang berjalan sahaja. Tambah -a untuk lihat semua, termasuk yang berhenti.
docker ps -a.Bekas ada kitaran hidup. Setiap arahan gerakkannya satu langkah. Ketik setiap langkah.
Bekukan web dengan docker pause web. Kemudian semak docker ps. Apa kata STATUS?
job tunjuk Exited (0). Adakah itu teruk?
docker inspect baca label penuh pada bekas: setiap butiran yang Docker tahu. -f pilih satu baris sahaja.
Betul, atau belum tepat? Leret setiap kad.
Kini anda boleh baca keadaan container dan kenal yang rosak.
You finished this before. Practice is always welcome!
Official docs: docker ps · docker inspect · docker stop · docker pause
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?