BM: Baca dalam Bahasa Melayu
World D4: Set Meals
Live reload with compose watch
You will learn: to see your edits in the running app as you save.
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.
You saved a new page. The shop still shows the old one. Why? The page was baked into the image before your edit.
Predict
How do you get the new page into the shop?
Pick one answer.
Try it
Prove it. Bake again, then knock on hatch 8080.
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 up -d --build, then curl localhost:8080.Watch
web:
build: ./web
develop:
watch:
- action: sync
path: ./web
target: /usr/share/nginx/htmlcompose watch: Watches your files and copies, restarts or rebuilds a service when you save. watches your folder. When you save, it copies the file into the running box. No bake, no restart.
Try it
Pick the right watch action for each file.
Drag a card into a box. Or tap the card, then tap the box.
Check
Watch only follows dishes that have build:. Which dish of our shop can it never watch?
Pick one answer.
You did it!
You can now see your edits live with compose watch.
Go deeper (optional)
docker compose up --watch starts and watches in one go, with logs mixed in. The box needs stat, mkdir and rmdir, and its user must be allowed to write the target. ignore: skips folders like node_modules/. A rebuild prints Rebuilding service(s) ["api"] after changes were detected....
Real mission
docker compose watchdocker compose down
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Anda simpan laman baru. Kedai masih tunjuk yang lama. Kenapa? Laman itu dah dibakar ke dalam image sebelum anda sunting.
Macam mana nak masukkan laman baru ke dalam kedai?
Buktikan. Bakar semula, kemudian ketuk tingkap 8080.
docker compose up -d --build, kemudian curl localhost:8080. web:
build: ./web
develop:
watch:
- action: sync
path: ./web
target: /usr/share/nginx/htmlcompose watch perhati folder anda. Bila anda simpan, ia salin fail itu ke dalam bekas yang sedang berjalan. Tiada bakar, tiada restart.
Pilih tindakan watch yang betul untuk setiap fail.
Watch hanya ikut hidangan yang ada build:. Hidangan kedai kita yang mana tak boleh langsung diperhati?
Kini anda boleh nampak suntingan anda secara langsung dengan compose watch.
You finished this before. Practice is always welcome!
Official docs: Use Compose Watch · docker compose watch · Compose file reference: develop
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?