BM: Baca dalam Bahasa Melayu
World D6: Under the Hood · Boss challenge
X-ray
You will learn: to turn a plain process into a container, one namespace and one limit at a time.
Checked with Docker Engine 29 on 31 Oct 2026
The problem
Boss mission: the X-ray. node server.js is a plain process on Aina’s laptop. You will make it a container, one switch at a time. First: what is a container, really?
Pick one answer.
Try it
Room 1: hide the laptop’s other processes from it.
Turn on the switch that hides other processes.
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/
Hint
The PID switch sits next to the process list.Predict
PID is on. Yet ps inside would still list the laptop’s processes. Why?
Pick one answer.
Try it
Room 2: turn on Docker’s own set of blinkers, until the banner says container.
Turn on the switches docker run uses, until it is a container.
Just a process. It sees the whole laptop.
What it can see (namespaces)
Processes it sees
1 node server.js← this process
Inside, it is PID 1. But ps reads /proc. Docker also mounts a fresh /proc (the Mount switch).
Files it sees
/home/aina/kedai/server.js/home/aina/.ssh/id_ed25519/home/aina/Photos//var/lib/docker/
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
User
Inside:
uid=0(root)On the laptop:
uid=0(root on the laptop too!)Docker uses this switch only in rootless mode, or with userns-remap.
Hint
Docker turns on five: PID, Mount, Network, UTS and IPC. User stays off.Try it
Room 3: now a real one. web runs nginx. See it from inside with docker exec web ps, then from the laptop with docker top web.
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
Inside first:docker exec web ps. Then the laptop’s view: docker top web.Try it
Room 4: add portion limits, and the last blinker. Turn on every switch.
Turn on every switch. Watch what the process can see and use.
A container now: Docker's default switches are on.
What it can see (namespaces)
Processes it sees
1 node server.js← this process
Files it sees
/app/server.js/usr/local/bin/node/etc/alpine-release
Docker also swaps the root folder for the image's files.
Network
lo 127.0.0.1eth0 172.17.0.2
Docker plugs in a virtual cable, called eth0.
Hostname
3f9c2a7b1d04Shared memory
Nothing shared. Other apps' memory is hidden.
User
Inside:
uid=0(root)On the laptop:
uid=0(root on the laptop too!)Docker uses this switch only in rootless mode, or with userns-remap.
What it can use (cgroups)
Limits
- Memory
- No limit: all 16 GB
- CPU
- No limit: all 8 CPUs
- Processes
- No limit
Hint
Still off: User, Memory limit, CPU limit and Process limit.Check
Last room: what happens when you type docker run? Put it in order, first at the top.
First step at the top. Put these in order. Use the arrows, or drag.
- containerd stacks the image layers with a fresh top sheet
- You type docker run
- dockerd passes the order to containerd
- Your app starts as PID 1, and runc leaves
- runc switches on namespaces and cgroups
You did it!
You can now build a container in your head, switch by switch.
Go deeper (optional)
Real rep (optional, Linux): flip real switches with unshare. A new network namespace has only lo, and it starts down. Nothing changes on your laptop.
Real mission
sudo unshare --pid --fork --mount-proc --uts --net shpsip linkexit
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Misi bos: X-ray. node server.js ialah proses biasa dalam laptop Aina. Anda akan jadikannya container, satu suis pada satu masa. Mula-mula: apa sebenarnya container?
Bilik 1: sorok proses lain dalam laptop daripadanya.
PID dah hidup. Tapi ps di dalam masih senaraikan proses laptop. Kenapa?
Bilik 2: hidupkan set penutup mata Docker sendiri, sampai sepanduk tulis container.
Bilik 3: sekarang yang sebenar. web jalankan nginx. Lihat dari dalam dengan docker exec web ps, kemudian dari laptop dengan docker top web.
docker exec web ps. Kemudian pandangan laptop: docker top web.Bilik 4: tambah had catuan, dan penutup mata terakhir. Hidupkan semua suis.
Bilik terakhir: apa jadi bila anda taip docker run? Susun, yang pertama di atas.
Kini anda boleh bina container dalam kepala, suis demi suis.
You finished this before. Practice is always welcome!
Official docs: namespaces(7) · cgroups(7) · docker container top
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?