World map

 

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

You saved a new page. curl still shows the old one: Kedai Kancil, without open. Docker transcript: $ docker compose up -d [+] up 5/5 ✔ Network kedai-kancil_default Created 0.1s ✔ Volume kedai-kancil_db-data Created 0.0s ✔ Container kedai-kancil-web-1 Started 0.3s ✔ Container kedai-kancil-api-1 Started 0.3s ✔ Container kedai-kancil-db-1 Started 0.3s $ echo "<h1>Kedai Kancil: open!</h1>" > web/index.html $ curl -s localhost:8080 <h1>Kedai Kancil</h1>

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
    from kedai-kancil-api kedai-kancil_default
  • kedai-kancil-db-1running
    from postgres:18-alpine kedai-kancil_default kedai-kancil_db-data → /var/lib/postgresql
  • kedai-kancil-web-1running
    from kedai-kancil-web 8080→80 kedai-kancil_default

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.

Watch

  web:
    build: ./web
    develop:
      watch:
        - action: sync
          path: ./web
          target: /usr/share/nginx/html
bash
docker compose watch
Watch enabled
Syncing service "web" after 1 changes were detected
docker compose watch starts the shop (its build lines are left out here), then says Watch enabled. You save web/index.html in your editor. Watch copies it in: Syncing service web after 1 changes were detected.

compose 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

        1. docker compose watch
        2. docker compose down

        0 of 4 steps done · Your ticks are saved.