Paths start at / (root). Each file has permissions (owner/group/others) and ownership. Docker uses this when setting up container roots and volume mounts.
drwxr-xr-x root:root drwxr-xr-x root:root drwxr-xr-x root:root drwxr-xr-x root:root drwxrwxrwx root:root drwxr-xr-x myappuser:myappuser Mount points attach filesystems into the tree; the kernel's mount table records what is mounted where. Bind mount = same filesystem at another path.
/ ├── home/ ├── etc/ ├── var/ │ └── lib/ │ └── docker/ │ └── containers/ │ └── abc123…/ ← container root │ ├── app/ │ ├── etc/ │ └── bin/
/ ← container root ├── app/ ├── etc/ └── bin/
alpine:3.19apk add --no-cache nodejsNODE_ENV=production/apppackage*.json ./npm ci --omit=dev. .["node", "server.js"]Only FROM, RUN, COPY, and ADD create layers. ENV, WORKDIR, CMD, etc. set metadata only.
alpine:3.19cachedapk add --no-cache nodejscachedNODE_ENV=productioncached/srcrebuiltpackage*.json ./rebuiltnpm ci --omit=devrebuilt. .rebuilt["node", "server.js"]rebuiltChanging WORKDIR from /app to /src invalidates cache at that line. Commands before: cache hit. From layer 3 onward: rebuilt.
alpine:3.19package*.json ./npm ciFROM doesn't add one layer—it attaches your image to the base image's entire layer stack. Your RUN/COPY/ADD layers sit on top.
Each layer (bottom to top) adds or changes files. The union is the read-only filesystem for the container.
Start container to see the writable layer. Stop freezes the view; Restart clears and returns to image only.
Without a volume, writes in the container are only in the R/W layer and disappear when the container is removed.
A packet flows through the stack. Incoming: interface → routing → iptables → app. Outgoing: app → (DNS for hostnames) → routing → iptables → interface.
Packet arrives on host eth0 with destination host:8080.
Node server (A) and Postgres (B) each have their own network namespace with lo and eth0. The bridge and veth pairs live on the host.
Both animations run together. Host mode packet (blue) reaches the app in half the time—fewer hops, no iptables, bridge, or veth.