BM: Baca dalam Bahasa Melayu
World D4: Set Meals
Run the stack: up and down
You will learn: to start, check, step into and stop a whole stack.
Checked with Docker Engine 29 on 31 Oct 2026
The problem
Your laptop~/kedai-kancil
- No open hatches
Lunchboxes (containers)
- No containers yet
Frozen packs (images)
- kedai-kancil-api:latest6 layers · 244MB
- kedai-kancil-web:latest9 layers · 92.6MB
- nginx:1.30-alpine8 layers · 93.5MB
- node:24-alpine4 layers · 244MB
- postgres:18-alpine9 layers · 433MB
- redis:8-alpine7 layers · 162MB
0 containers (0 running), 6 images, 0 lockers.
-d runs the set meal in the background. Your terminal is free again. But now you can’t see inside. Is the API even awake?
Try it
Ask Compose what is running. docker compose ps lists this project: One set meal on the table. Its name comes from the folder, so containers are called kedai-kancil-web-1.’s lunchboxes and their state.
Your laptop~/kedai-kancil
- Laptop port 8080 → kedai-kancil-web-1 port 80
Lunchboxes (containers)
- kedai-kancil-api-1running
- kedai-kancil-db-1running
- kedai-kancil-web-1running
Frozen packs (images)
- kedai-kancil-api:latest6 layers · 244MB · in use
- kedai-kancil-web:latest9 layers · 92.6MB · in use
- nginx:1.30-alpine8 layers · 93.5MB
- node:24-alpine4 layers · 244MB
- postgres:18-alpine9 layers · 433MB · in use
- redis:8-alpine7 layers · 162MB
Lockers (volumes)
- kedai-kancil_db-data24 files · used by kedai-kancil-db-1
Phone lines (networks)
- kedai-kancil_defaultkedai-kancil-api-1 ↔ kedai-kancil-db-1 ↔ kedai-kancil-web-1
3 containers (3 running), 6 images, 1 lockers.
Hint
Typedocker compose ps.Watch
Your laptop~/kedai-kancil
- No open hatches
Lunchboxes (containers)
- No containers yet
Frozen packs (images)
- kedai-kancil-api:latest6 layers · 244MB
- kedai-kancil-web:latest9 layers · 92.6MB
- nginx:1.30-alpine8 layers · 93.5MB
- node:24-alpine4 layers · 244MB
- postgres:18-alpine9 layers · 433MB
- redis:8-alpine7 layers · 162MB
0 containers (0 running), 6 images, 0 lockers.
docker compose logs api shows what api printed. Each line starts with the dish name, like api-1 |. Add -f to keep watching.
Try it
Build the command that opens a shell inside the web dish.
Tap the pieces in the right order.
Hint
Compose commands use service names: web, api, db.Predict
You run docker compose down. What happens to the orders in the db-data locker?
Pick one answer.
Try it
Close the shop for the night. Keep the lockers.
Your laptop~/kedai-kancil
- Laptop port 8080 → kedai-kancil-web-1 port 80
Lunchboxes (containers)
- kedai-kancil-api-1running
- kedai-kancil-db-1running
- kedai-kancil-web-1running
Frozen packs (images)
- kedai-kancil-api:latest6 layers · 244MB · in use
- kedai-kancil-web:latest9 layers · 92.6MB · in use
- nginx:1.30-alpine8 layers · 93.5MB
- node:24-alpine4 layers · 244MB
- postgres:18-alpine9 layers · 433MB · in use
- redis:8-alpine7 layers · 162MB
Lockers (volumes)
- kedai-kancil_db-data24 files · used by kedai-kancil-db-1
Phone lines (networks)
- kedai-kancil_defaultkedai-kancil-api-1 ↔ kedai-kancil-db-1 ↔ kedai-kancil-web-1
3 containers (3 running), 6 images, 1 lockers.
Hint
No-v tonight.You did it!
You can now start, check and stop a whole stack.
Go deeper (optional)
docker compose stop pauses the shop but keeps the boxes; start wakes them. docker compose restart api restarts one dish. docker compose down -v also deletes the lockers and their data: use it only on purpose. docker compose ls lists every running project.
Real mission
docker compose up -ddocker compose psdocker compose logs webdocker compose exec web shdocker compose down
0 of 5 steps done · Your ticks are saved.
Bahasa Melayu
-d jalankan set hidangan di latar belakang. Terminal anda bebas semula. Tapi sekarang anda tak nampak ke dalam. API dah bangun ke belum?
Tanya Compose apa yang sedang berjalan. docker compose ps senaraikan bekas dalam projek ini dan keadaannya.
docker compose ps.docker compose logs api tunjuk apa yang api paparkan. Setiap baris bermula dengan nama hidangan, contohnya api-1 |. Tambah -f untuk terus tengok.
Bina arahan yang buka shell di dalam hidangan web.
Anda jalankan docker compose down. Apa jadi pada pesanan dalam loker db-data?
Tutup kedai untuk malam ini. Simpan loker.
-v malam ini.Kini anda boleh hidupkan, semak dan hentikan seluruh stack.
You finished this before. Practice is always welcome!
Official docs: docker compose up · docker compose ps · docker compose logs · docker compose exec · docker compose down
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?