World map

 

BM: Baca dalam Bahasa Melayu

World D0: Start Here

Networking crash course

You will learn: five network words, IP address, port, localhost, DNS and status codes, to find out why an app can’t be reached.

Checked with Docker Engine 29 on 31 Oct 2026

The problem

curl asks port 9090 and gets: Failed to connect to localhost port 9090. Couldn't connect to server. Docker transcript: $ curl localhost:9090 curl: (7) Failed to connect to localhost port 9090 after 0 ms: Couldn't connect to server

Your laptop~/shop

  • Laptop port 8080 → shop port 80

Lunchboxes (containers)

  • shoprunning
    from nginx:1.30-alpine 8080→80 ~/shop/site → /usr/share/nginx/html

Frozen packs (images)

  • nginx:1.30-alpine8 layers · 93.5MB · in use

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

Your app runs, but you can’t reach it. Is it the address? The door? The app itself? Five network words will tell you.

Watch

Every computer on a network has an IP address: A computer's street address on a network, like 192.168.1.20.. It is like a street address for a building. Which one is an IP address?

Pick one answer.

Watch

Tap each point on the timeline.

One building has many numbered hatches. Each app waits for orders at its own port: A numbered hatch on a computer. Each app waits for orders at its own number, like 8080.. Tap a few famous ones.

Try it

localhost: This computer itself. Its address is 127.0.0.1. means “this computer, right here”. The shop is open at hatch 8080. curl fetches a page, like a tiny browser. Type curl localhost:8080.

Your laptop~/shop

  • Laptop port 8080 → shop port 80

Lunchboxes (containers)

  • shoprunning
    from nginx:1.30-alpine 8080→80 ~/shop/site → /usr/share/nginx/html

Frozen packs (images)

  • nginx:1.30-alpine8 layers · 93.5MB · in use

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

Watch

/etc/hosts lists localhost as 127.0.0.1. Then curl says: Could not resolve host: kedai-kancil. Docker transcript: $ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 laptop # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback $ curl http://kedai-kancil:8080 curl: (6) Could not resolve host: kedai-kancil

Your laptop~/shop

  • Laptop port 8080 → shop port 80

Lunchboxes (containers)

  • shoprunning
    from nginx:1.30-alpine 8080→80 ~/shop/site → /usr/share/nginx/html

Frozen packs (images)

  • nginx:1.30-alpine8 layers · 93.5MB · in use

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

DNS: The phone book of the network. It turns a name into an IP address. is the phone book: it turns a name into an IP address. Your laptop also keeps a tiny phone book, /etc/hosts. Nobody lists kedai-kancil, so curl gives up.

Predict

curl says Could not resolve host. Which part failed?

Pick one answer.

Try it

When a server answers, it starts with an HTTP status code: The counter's reply in three digits: 200 means here you go, 404 means not on the menu.. 2xx: here you go. 4xx: your order is off. 5xx: kitchen trouble. Sort these.

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

        Check

        Ask the shop for two pages. curl -I shows only the top of the reply. Try /menu.html, then /sambal.html. Read the first line each time.

        Your laptop~/shop

        • Laptop port 8080 → shop port 80

        Lunchboxes (containers)

        • shoprunning
          from nginx:1.30-alpine 8080→80 ~/shop/site → /usr/share/nginx/html

        Frozen packs (images)

        • nginx:1.30-alpine8 layers · 93.5MB · in use

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

        You did it!

        You can now find out why an app can’t be reached.

        Go deeper (optional)

        127.0.0.1 is localhost’s own number. In Docker output, 0.0.0.0:8080 means “port 8080 on every address of this laptop”. A browser at http://localhost:8080 asks the same as curl.

        Real rep (optional): with Docker installed, run docker run -d --name web -p 8080:80 nginx:1.30-alpine. Open http://localhost:8080 in your browser. Clean up with docker rm -f web.