BM: Baca dalam Bahasa Melayu
World D4: Set Meals
Optional extras: profiles
You will learn: to keep extra dishes off until you ask for them.
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.
The cache is right there in compose.yaml. You ran docker compose up -d. So why is it not running?
Watch
cache:
image: redis:8-alpine
profiles: [cache]A side dish comes only when you ask for it. That is a profile: A side dish: a service that starts only when you ask, with --profile or by its name.. A dish with a profile stays off. You turn it on when you need it. Sort the dishes.
Drag a card into a box. Or tap the card, then tap the box.
Try it
Order the side dish too. Turn on the cache profile.
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
docker compose --profile cache up -dPredict
No --profile at all. You type docker compose up -d cache. What happens?
Pick one answer.
Check
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.
Careful at closing time. Plain down only clears dishes without a profile. Add --profile cache to clear the side dish too.
You did it!
You can now keep extra dishes off until you ask for them.
Go deeper (optional)
COMPOSE_PROFILES=cache docker compose up -d does the same as the flag. Turn on two with --profile cache --profile debug. Good side dishes: debug tools, an admin page, a job that loads test data. Profile names use letters, digits, _, . and -.
Real mission
docker compose config --servicesdocker compose --profile cache config --services
0 of 3 steps done · Your ticks are saved.
Bahasa Melayu
Cache ada dalam compose.yaml. Anda dah jalankan docker compose up -d. Jadi kenapa ia tak berjalan?
cache:
image: redis:8-alpine
profiles: [cache]Lauk tambahan datang hanya bila anda minta. Itulah profile. Hidangan yang ada profile kekal tutup. Anda hidupkannya bila perlu. Susun hidangan ini.
Pesan lauk tambahan juga. Hidupkan profile cache.
docker compose --profile cache up -dLangsung tiada --profile. Anda taip docker compose up -d cache. Apa jadi?
Hati-hati masa tutup kedai. down biasa hanya kemas hidangan tanpa profile. Tambah --profile cache untuk kemas lauk tambahan juga.
Kini anda boleh biarkan hidangan tambahan tutup sampai anda memintanya.
You finished this before. Practice is always welcome!
Official docs: Using profiles with Compose · Compose file reference: profiles
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?