World map

 

BM: Baca dalam Bahasa Melayu

World D1: First Containers

Image vs container

You will learn: how one image (a meal pack) fills many containers (lunchboxes).

Checked with Docker Engine 29 on 31 Oct 2026

The problem

Ali deleted the welcome page inside his lunchbox. Then he filled a fresh lunchbox from the same meal pack. The page is back! Bug or feature?

Pick one answer.

Watch

docker images lists the nginx meal pack. Two docker run commands fill two lunchboxes from it, lunch1 and lunch2. docker ps shows both running. Docker transcript: $ docker images i Info → U In Use IMAGE ID DISK USAGE CONTENT SIZE EXTRA alpine:3.22 2e0b81d60597 12.9MB 3.88MB nginx:1.30-alpine 0e52bd054126 93.5MB 27MB $ docker run -d --name lunch1 nginx:1.30-alpine 2f1e4458ce8eeb100f4beb4a2a42307bc50f70777b97668cd744a843fd5270df $ docker run -d --name lunch2 nginx:1.30-alpine 5e58aeadbf439542332dc96b9b89c8c3cab36fa6762c85b2147fbed0479af324 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5e58aeadbf43 nginx:1.30-alpine "/docker-entrypoint.…" 3 seconds ago Up 3 seconds 80/tcp lunch2 2f1e4458ce8e nginx:1.30-alpine "/docker-entrypoint.…" 6 seconds ago Up 6 seconds 80/tcp lunch1

Your laptop~

  • No open hatches

Lunchboxes (containers)

  • No containers yet

Frozen packs (images)

  • alpine:3.221 layers · 12.9MB
  • nginx:1.30-alpine8 layers · 93.5MB

0 containers (0 running), 2 images, 0 lockers.

One frozen meal pack fills two lunchboxes. The pack is the image: A frozen meal pack you can copy again and again. Containers start from it.: a template that never changes. Each container: A sealed lunchbox that holds your app and everything it needs. is one box made from it.

Try it

Sort each card. Is it about the meal pack or the lunchbox?

Drag a card into a box. Or tap the card, then tap the box.

      Try it

      Fill two lunchboxes from one pack. Run docker run alpine:3.22 echo hi twice. Then type docker images.

      Your laptop~

      • No open hatches

      Lunchboxes (containers)

      • No containers yet

      Frozen packs (images)

      • alpine:3.221 layers · 12.9MB
      • nginx:1.30-alpine8 layers · 93.5MB

      0 containers (0 running), 2 images, 0 lockers.

      Predict

      You delete index.html inside lunch1. Then you look inside lunch2. Is index.html there?

      Pick one answer.

      Check

      index.html is deleted inside lunch1. lunch1 now lists only 50x.html. lunch2 still lists 50x.html and index.html. Docker transcript: $ docker run -d --name lunch1 nginx:1.30-alpine 2f1e4458ce8eeb100f4beb4a2a42307bc50f70777b97668cd744a843fd5270df $ docker run -d --name lunch2 nginx:1.30-alpine 5e58aeadbf439542332dc96b9b89c8c3cab36fa6762c85b2147fbed0479af324 $ docker exec lunch1 rm /usr/share/nginx/html/index.html $ docker exec lunch1 ls /usr/share/nginx/html 50x.html $ docker exec lunch2 ls /usr/share/nginx/html 50x.html index.html

      Your laptop~

      • No open hatches

      Lunchboxes (containers)

      • No containers yet

      Frozen packs (images)

      • alpine:3.221 layers · 12.9MB
      • nginx:1.30-alpine8 layers · 93.5MB

      0 containers (0 running), 2 images, 0 lockers.

      Proof! The page left lunch1 only. lunch2 still has it. docker exec runs a command inside a box. Lesson 6 has more.

      You did it!

      You can now tell a meal pack (image) from a lunchbox (container).

      Go deeper (optional)

      A container is its image plus a thin writable layer on top. Every change goes into that layer. Remove the box, and its layer goes too. The image underneath stays untouched.

      Real rep (optional):

      Real mission

      1. docker run alpine:3.22 echo hi
      2. docker ps -a
      3. docker images

      0 of 4 steps done · Your ticks are saved.