BM: Baca dalam Bahasa Melayu
World D6: Under the Hood
Namespaces: what it can see
You will learn: how Linux namespaces give a process its own processes, network and hostname.
Checked with Docker Engine 29 on 31 Oct 2026
The problem
This plain process, node server.js, sees every program on the laptop. Inside a container, ps showed just one. Flip the two switches and watch.
Turn on PID, then Mount. Watch the process list.
What it can see (namespaces)
Processes it sees
1 /sbin/init412 sshd655 containerd701 dockerd1880 firefox4242 node server.js← this process
Files it sees
/home/aina/kedai/server.js/home/aina/.ssh/id_ed25519/home/aina/Photos//var/lib/docker/
Watch
Your laptop~
- Laptop port 8080 → web port 80
Lunchboxes (containers)
- webrunning
Frozen packs (images)
- nginx:1.30-alpine8 layers · 93.5MB · in use
1 containers (1 running), 1 images, 0 lockers.
Two different names! Each switch is a namespace (Linux): Blinkers for a process: it sees only its own processes, network, files or hostname. Not a Kubernetes namespace.. A namespace is a pair of blinkers. It hides one thing, like the laptop’s hostname.
Try it
Find the blinker that gives the process its own network card.
Which switch gives it its own network?
What it can see (namespaces)
Network
lo 127.0.0.1wlan0 192.168.1.20docker0 172.17.0.1
Hostname
aina-laptopShared memory
- shared memory from firefox
- shared memory from pulseaudio
Hint
Look for the switch next to the Network panel.Predict
Two nginx containers both listen on port 80 inside. Will they clash?
Pick one answer.
Try it
Prove it. Start a second nginx called web2, without -p.
Your laptop~
- Laptop port 8080 → web port 80
Lunchboxes (containers)
- webrunning
Frozen packs (images)
- nginx:1.30-alpine8 layers · 93.5MB · in use
1 containers (1 running), 1 images, 0 lockers.
Hint
docker run -d --name web2 nginx:1.30-alpine starts it in the background.Check
Which namespace hides each thing?
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now explain how namespaces change what a container sees.
Go deeper (optional)
Linux has 8 kinds: cgroup, IPC, network, mount, PID, time, user and UTS. Docker turns on PID, mount, network, UTS and IPC (plus cgroup on cgroup v2). The user one stays off by default (lesson 6). A Kubernetes namespace is a different idea: a zone of the food court.
Real rep (optional, Linux): make your own namespaces.
Real mission
sudo unshare --uts --pid --fork --mount-proc shhostname kancilpsexit
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Proses biasa ini, node server.js, nampak semua program dalam laptop. Dalam container, ps tunjuk satu sahaja. Hidupkan dua suis ini dan tengok.
Dua nama berbeza! Setiap suis ialah satu namespace. Namespace (ruang nama) ialah penutup mata. Ia sorok satu benda, contohnya hostname laptop.
Cari penutup mata yang beri proses itu kad rangkaian sendiri.
Dua container nginx sama-sama dengar port 80 di dalam. Adakah ia berlanggar?
Buktikan. Mulakan nginx kedua bernama web2, tanpa -p.
docker run -d --name web2 nginx:1.30-alpine mulakannya di latar belakang.Namespace mana yang sorok setiap benda?
Kini anda boleh terangkan cara namespace ubah apa yang container nampak.
You finished this before. Practice is always welcome!
Official docs: namespaces(7) · Docker security: kernel namespaces · unshare(1)
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?