World map

 

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

Three lunchboxes start in the background. The terminal is free again. 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

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
    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

The api log has one line: API listening on port 3000. 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 $ docker compose logs api api-1 | API listening on port 3000

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.

…

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
    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.

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

  1. docker compose up -d
  2. docker compose ps
  3. docker compose logs web
  4. docker compose exec web sh
  5. docker compose down

0 of 5 steps done · Your ticks are saved.