---
title: "Lab: Inside a Container"
domain: cloud-computing
level: beginner
duration: "75 min"
cost: "free"
environment: "your own Linux computer (or a Linux VM) with Podman 4 or later, rootless"
---

# Lab: Inside a Container

## Goal
Build a small container image from a `Containerfile` with a pinned base image and inspect its layers. Then run it and look at the container from the host: its processes, its namespaces and its cgroup. Finally, set CPU and memory limits, read them in the cgroup files, and trigger an out-of-memory (OOM) kill on purpose so you can diagnose it.

## Objectives
- Build an image from a `Containerfile` with a pinned base image and explain its layers (objective 4).
- Show that a container is an ordinary host process in its own namespaces: compare hostname, process list and namespace IDs inside and outside (objective 3).
- Set `--cpus` and `--memory` limits and read them as `cpu.max` and `memory.max` in the cgroup v2 files (objectives 3 and 5).
- Trigger an OOM kill and diagnose it with `OOMKilled`, exit code 137 and the kernel log (objective 5).

## Prerequisites
- A Linux machine, or a Linux VM, with Podman 4 or later (tested with Podman 5.8.7, rootless, cgroups v2, `crun`, no `sudo`). Docker works with small changes: see the NOTE below.
- A user shell (not `root`). Everything in this lab runs without `sudo`.
- Internet access to pull the base image `docker.io/library/alpine:3.20.10` (about 8 MB), and to download one small package (`procps-ng`) during the build.
- About 30 MB of disk space.
- [The lesson](lesson.md) of this module.

> [!WARNING]
> The lab is free, and runs only containers that you start on your own machine, as an ordinary user and without `--privileged`. Every container is named `lab-virt-...`, and the commands that remove things name them explicitly, so they don't touch your other containers. One step makes a container use more memory than its limit on purpose; it can only hurt that container, not your machine. The lab changes nothing on your system outside one folder (`~/virt-lab`) and one local image, both removed at the end.

> [!NOTE]
> The outputs below were captured on Fedora-based Linux in November 2026. IDs, PIDs, namespace numbers, times and the host name differ on your machine; the structure and the values that come from your commands (such as `67108864`) are what you should compare.
>
> **Docker:** replace `podman` with `docker` and the `Containerfile` name stays valid (`docker build -f Containerfile` if your version doesn't find it). Two differences: with the default rootful Docker, the container's processes belong to `root`, so reading `/proc/<pid>/ns` and the OOM log may need `sudo`, and `podman top ... hpid huser` has no Docker equivalent. This was not tested with Docker.

## Architecture
![On your Linux machine, running rootless Podman without sudo, the folder ~/virt-lab holds a Containerfile and app.sh. Podman builds them into the image localhost/lab-virt-hello:1.0, which has three layers and is about 9.4 MB. The base image comes from a registry on the Internet, docker.io/library/alpine, tag 3.20.10. The image runs as three containers whose names start with lab-virt-: lab-virt-demo, running sleep 3600 with no limits; lab-virt-limited, with CPU limit 0.5 and memory limit 64 MB; and lab-virt-oom, with a memory limit of 64 MB that allocates 200 MB and is killed. The containers are isolated and limited by the host Linux kernel, which you inspect from the host: /proc/<pid>/ns for namespaces, /sys/fs/cgroup for memory.max and cpu.max, and the kernel log for the OOM killer and exit code 137.](../../../assets/diagrams/virt-lab-architecture.svg)

*Figure 1. You build one image from a folder, run it as three containers, and read what the host kernel did to isolate and limit them.*

## Steps

### Step 1 — Check your tools and create a working folder
First, check that you have Podman, that it runs without root, and that your system uses cgroups v2. You keep all lab files in one folder so the cleanup is simple.

```bash
podman --version
podman info --format 'rootless={{.Host.Security.Rootless}} cgroups={{.Host.CgroupsVersion}} runtime={{.Host.OCIRuntime.Name}}'
stat -fc %T /sys/fs/cgroup
mkdir -p ~/virt-lab && cd ~/virt-lab
```

Expected output (the version may be newer; the runtime may be `runc`):
```text
podman version 5.8.7
rootless=true cgroups=v2 runtime=crun
cgroup2fs
```

`cgroup2fs` means the cgroup v2 file system is mounted at `/sys/fs/cgroup`. If you see `tmpfs`, your system uses cgroups v1 and the limit steps won't match; see Troubleshooting.

> [!WARNING]
> Run every following command from `~/virt-lab`, unless a step says otherwise.

### Step 2 — Write the application and the Containerfile
The application is a tiny shell script. The `Containerfile` lists the build steps; each step that changes files adds a layer. Pin the base image to an exact version tag (`3.20.10`), not `latest`, so the build is repeatable.

```bash
cat > app.sh <<'EOF'
#!/bin/sh
echo "Hello from $(hostname), running as $(id -un) (PID $$)"
EOF
chmod +x app.sh

cat > Containerfile <<'EOF'
FROM docker.io/library/alpine:3.20.10
LABEL org.opencontainers.image.title="lab-virt-hello"
RUN apk add --no-cache procps-ng
COPY app.sh /usr/local/bin/app.sh
CMD ["/usr/local/bin/app.sh"]
EOF
```

What each line does:
- `FROM` chooses the base image and its layers.
- `LABEL` adds metadata to the image configuration (no new layer).
- `RUN` runs a command in a temporary container and keeps the file changes as a new layer.
- `COPY` adds a file from your folder as a new layer.
- `CMD` sets the default command (metadata only).

> [!NOTE]
> The `RUN` line is there to give the image a layer you can see. Network access during the build is needed for it.

### Step 3 — Build the image
```bash
podman build -t lab-virt-hello:1.0 .
```

`-t` names the image `lab-virt-hello` with the tag `1.0`, and `.` is the build context (this folder).

Expected output (IDs differ; the `apk` download lines are trimmed):
```text
STEP 1/5: FROM docker.io/library/alpine:3.20.10
STEP 2/5: LABEL org.opencontainers.image.title="lab-virt-hello"
--> b1be2b84c186
STEP 3/5: RUN apk add --no-cache procps-ng
Executing busybox-1.36.1-r31.trigger
OK: 9 MiB in 19 packages
--> c76c408b748b
STEP 4/5: COPY app.sh /usr/local/bin/app.sh
--> 964fed8bd61c
STEP 5/5: CMD ["/usr/local/bin/app.sh"]
COMMIT lab-virt-hello:1.0
--> de5c993d6a99
Successfully tagged localhost/lab-virt-hello:1.0
de5c993d6a996bcc2d734c27e4290c4d4d80a12865dc8c7833be391f7e51feb6
```

The first time, Podman also prints `Trying to pull docker.io/library/alpine:3.20.10...` and the blob download lines. Check the image:

```bash
podman images lab-virt-hello
```

```text
REPOSITORY                TAG         IMAGE ID      CREATED                 SIZE
localhost/lab-virt-hello  1.0         de5c993d6a99  Less than a second ago  9.37 MB
```

### Step 4 — Inspect the layers
`podman history` lists one line per build instruction, with the size of the layer it added.

```bash
podman history lab-virt-hello:1.0
```

Expected output (trimmed to fit; times and IDs differ):
```text
ID            CREATED                 CREATED BY                                     SIZE        COMMENT
964fed8bd61c  Less than a second ago  /bin/sh -c #(nop) CMD ["/usr/local/bin/app...  0B
<missing>     Less than a second ago  /bin/sh -c #(nop) COPY file:23760a3ecceb3e...  3.58kB
c76c408b748b  Less than a second ago  /bin/sh -c apk add --no-cache procps-ng        1.27MB
bf8527eb54c3  1 second ago            /bin/sh -c #(nop) LABEL org.opencontainers...  0B          FROM docker.i...
<missing>     6 months ago            CMD ["/bin/sh"]                                0B          buildkit.dock...
<missing>     6 months ago            ADD alpine-minirootfs-3.20.10-x86_64.tar.g...  8.09MB      buildkit.dock...
```

Read it from the bottom: the base image's root file system (8.09 MB), your `RUN` (1.27 MB), your `COPY` (3.58 kB). `CMD` and `LABEL` are 0 B: they only change the configuration. Now ask for the layers and the format directly:

```bash
podman image inspect lab-virt-hello:1.0 --format 'Layers: {{len .RootFS.Layers}}  Cmd: {{.Config.Cmd}}  Format: {{.ManifestType}}'
podman image inspect lab-virt-hello:1.0 --format '{{range .RootFS.Layers}}{{println .}}{{end}}'
```

Expected output (the first layer, Alpine, is the same on your machine; the other two differ, because their content includes build times):
```text
Layers: 3  Cmd: [/usr/local/bin/app.sh]  Format: application/vnd.oci.image.manifest.v1+json
sha256:08bc4e534116aa76b16015484b82eac51f9a593416feae9296c8a2d4bb7aa4a2
sha256:f55ed2bae43c665dab4e7586118f8ad3e837d47e4f580dbc8c6ae63b55ac8f5e
sha256:df259c8f1ca6356b3feac01c6d60efbe8439114afa5442ddbcfba2f5286d92c7
```

Three layers (the base, `RUN`, `COPY`), each named by the SHA-256 digest of its content, and an image in the OCI image format (`application/vnd.oci.image.manifest.v1+json`).

> [!NOTE]
> The digests above are the uncompressed content IDs (`diff_id` in the image configuration). The digests of the compressed layers in the manifest, which a registry uses, are different values.

### Step 5 — Run the container
Run it once in the foreground. `--rm` deletes the container when it exits, and `--name` follows the `lab-virt-` rule.

```bash
podman run --rm --name lab-virt-hello lab-virt-hello:1.0
```

Expected output (the hostname is the first 12 characters of the container ID, so yours differs):
```text
Hello from 5088d1aeb13f, running as root (PID 1)
```

Note three things: the hostname is not your computer's (uts namespace), the script is **PID 1** (pid namespace), and the user is `root` (a user namespace, as you'll see in Step 7).

### Step 6 — Compare the container's view with the host's
This time start a container that keeps running, so you can look at it from both sides.

```bash
podman run -d --name lab-virt-demo lab-virt-hello:1.0 sleep 3600
podman ps --filter name=lab-virt- --format 'table {{.Names}}\t{{.Status}}\t{{.Command}}'
```

Expected output (the first line is the full container ID):
```text
9f26995a174db194e15e4322e83b28bdfb0928df0ed9f5be2a803f0607cc6b50
NAMES          STATUS                 COMMAND
lab-virt-demo  Up Less than a second  sleep 3600
```

Ask Podman for the container's processes, with the host's view next to the container's:

```bash
podman top lab-virt-demo user pid hpid huser comm
```

```text
USER        PID         HPID        HUSER       COMMAND
root        1           41390       1000        sleep
```

`PID` is the number inside the container (1); `HPID` is the same process's PID on the host (41390 here, yours differs); `USER` is `root` inside, and `HUSER` is `1000` on the host: your own user ID. The "root" container is you. Now compare the views with commands run inside and outside:

```bash
podman exec lab-virt-demo hostname
podman exec lab-virt-demo ps -o pid,user,comm
podman exec lab-virt-demo uname -r
echo "--- host ---"
hostname
uname -r
```

Expected output:
```text
9f26995a174d
    PID USER     COMMAND
      1 root     sleep
      3 root     ps
7.2.4-ogc3.1.fc44.x86_64
--- host ---
bazzite
7.2.4-ogc3.1.fc44.x86_64
```

Inside you see a different hostname and only two processes (`sleep` as PID 1, and the `ps` you just started), where the host has hundreds. But `uname -r` prints the **same kernel version**: there is no guest kernel, the container shares the host's. This is the main difference from a VM.

### Step 7 — Look at the namespaces from the host
Every process has a link per namespace in `/proc/<pid>/ns/`. Two processes are in the same namespace when the number in the link is the same. Compare your shell with the container's `sleep`, using its host PID:

```bash
PID=$(podman inspect lab-virt-demo --format '{{.State.Pid}}')
echo "container PID on the host: $PID"
for ns in cgroup ipc mnt net pid user uts time; do
  printf '%-7s host %-18s container %s\n' $ns "$(readlink /proc/self/ns/$ns)" "$(readlink /proc/$PID/ns/$ns)"
done
```

Expected output (numbers differ on your machine; compare them in pairs):
```text
container PID on the host: 41390
cgroup  host cgroup:[4026531835] container cgroup:[4026533219]
ipc     host ipc:[4026531839]   container ipc:[4026533217]
mnt     host mnt:[4026531832]   container mnt:[4026533215]
net     host net:[4026531833]   container net:[4026533103]
pid     host pid:[4026531836]   container pid:[4026533218]
user    host user:[4026531837]  container user:[4026533101]
uts     host uts:[4026531838]   container uts:[4026533216]
time    host time:[4026531834]  container time:[4026531834]
```

Seven namespaces are different. The `time` namespace is the same: containers don't get their own by default. If `lsns` is installed (package `util-linux`), it lists the same information:

```bash
lsns -p $PID -o NS,TYPE,NPROCS,PID,COMMAND
```

```text
        NS TYPE   NPROCS   PID COMMAND
4026531834 time      153  1853 /usr/bin/mpris-proxy
4026533101 user       16 15774 catatonit -P
4026533103 net         1 41390 sleep 3600
4026533215 mnt         1 41390 sleep 3600
4026533216 uts         1 41390 sleep 3600
4026533217 ipc         1 41390 sleep 3600
4026533218 pid         1 41390 sleep 3600
4026533219 cgroup      1 41390 sleep 3600
```

The first row is the `time` namespace you share with the host (the `COMMAND` shown is just the oldest process in it). The `user` row has more processes than one: rootless Podman keeps one user namespace for all your containers, held by a small helper (`catatonit`).

Now the user namespace. Inside the container you are UID 0. Which user does the host think you are, and how is it mapped?

```bash
podman exec lab-virt-demo cat /proc/self/uid_map
stat -c 'owner of the host process: %U' /proc/$PID
```

```text
         0       1000          1
         1     524288      65536
owner of the host process: user
```

Read each row of `uid_map` as `<first UID inside> <first UID outside> <how many>`: container UID 0 is host UID 1000 (you; a count of 1), and container UIDs 1 to 65536 map to a range of UIDs reserved for you in `/etc/subuid`. The process on the host is owned by your own user name (`user` here; yours will differ). A bug that let the process escape would find only your rights, not root's.

### Step 8 — Set limits and read them in the cgroup
Start a second container with a limit of half a CPU and 64 MB of memory:

```bash
podman run -d --name lab-virt-limited --cpus 0.5 --memory 64m lab-virt-hello:1.0 sleep 3600
```

The container's cgroup is a directory below `/sys/fs/cgroup`. Find it from the host PID, and read the limit files:

```bash
PID=$(podman inspect lab-virt-limited --format '{{.State.Pid}}')
CG=/sys/fs/cgroup$(cut -d: -f3 /proc/$PID/cgroup)
echo "$CG"
for f in memory.max cpu.max pids.max memory.current; do printf '%-15s %s\n' $f "$(cat $CG/$f)"; done
```

Expected output (the container ID in the path differs, trimmed here to `<id>`; `memory.current` varies):
```text
/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/user.slice/libpod-<id>.scope/container
memory.max      67108864
cpu.max         50000 100000
pids.max        2048
memory.current  741376
```

- `memory.max` is `67108864`: 64 × 1024 × 1024 bytes, from `--memory 64m`.
- `cpu.max` is `50000 100000`: 50,000 µs of CPU time in each 100,000 µs period, which is 0.5 CPU, from `--cpus 0.5`.
- `pids.max` is a default Podman sets (2048 here; yours may differ).

Compare with the container that has no limits, `lab-virt-demo`:

```bash
CGD=/sys/fs/cgroup$(cut -d: -f3 /proc/$(podman inspect lab-virt-demo --format '{{.State.Pid}}')/cgroup)
for f in memory.max cpu.max; do printf '%-15s %s\n' $f "$(cat $CGD/$f)"; done
```

```text
memory.max      max
cpu.max         max 100000
```

`max` means "no limit". The container can also read its own limits, because it has its own cgroup namespace, where its cgroup looks like the root:

```bash
podman exec lab-virt-limited cat /sys/fs/cgroup/memory.max /sys/fs/cgroup/cpu.max
podman inspect lab-virt-limited --format 'Memory={{.HostConfig.Memory}} NanoCpus={{.HostConfig.NanoCpus}} CpuQuota={{.HostConfig.CpuQuota}} CpuPeriod={{.HostConfig.CpuPeriod}}'
```

```text
67108864
50000 100000
Memory=67108864 NanoCpus=500000000 CpuQuota=50000 CpuPeriod=100000
```

### Step 9 — Watch the CPU limit throttle a busy container
Start an endless loop inside the limited container. Without a limit it would use a full CPU; with `--cpus 0.5` it should get about half.

```bash
podman exec -d lab-virt-limited sh -c 'while :; do :; done'
sleep 8
podman stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}' lab-virt-limited
grep -E 'nr_periods|nr_throttled|throttled_usec' $CG/cpu.stat
```

Expected output (the percentages and counters vary):
```text
NAME              CPU %       MEM USAGE / LIMIT
lab-virt-limited  48.63%      450.6kB / 67.11MB
nr_periods 83
nr_throttled 78
throttled_usec 3373263
```

The loop wants 100% of a CPU but gets about 50%. `nr_throttled` counts the periods in which the cgroup used up its quota and was paused until the next period: almost every one of them (78 of 83). CPU over the limit means **slower**, not killed.

Remove the two containers. `sleep` as PID 1 ignores the stop signal (`SIGTERM`), so `-t 0` skips the 10-second wait:

```bash
podman rm -f -t 0 lab-virt-limited lab-virt-demo
```

```text
lab-virt-demo
lab-virt-limited
```

### Step 10 — Trigger an OOM kill on purpose
Now give a container 64 MB and ask its shell to hold a 200 MB string in memory. The command `head -c 200000000 /dev/zero | tr "\0" a` produces 200 MB of the letter `a`, and the shell keeps all of it in the variable `x`.

```bash
podman run --name lab-virt-oom --memory 64m lab-virt-hello:1.0 \
  sh -c 'x=$(head -c 200000000 /dev/zero | tr "\0" a); echo "allocated ${#x} bytes"'
echo "exit code: $?"
```

Expected output:
```text
exit code: 137
```

There is no "allocated" line: the shell was killed before it could print it. The name has no `--rm`, so you can inspect the stopped container. Exit code 137 is 128 + 9, which means `SIGKILL`. But is it the OOM killer? Ask the engine:

```bash
podman inspect lab-virt-oom --format 'OOMKilled={{.State.OOMKilled}} ExitCode={{.State.ExitCode}} Status={{.State.Status}}'
```

```text
OOMKilled=true ExitCode=137 Status=exited
```

`OOMKilled=true` confirms that the memory cgroup's OOM killer stopped it. The kernel log has the details:

```bash
journalctl -k --since "-2min" --no-pager | grep "Memory cgroup out of memory"
```

Expected output (shortened; PID and sizes vary):
```text
nov 07 19:55:34 bazzite kernel: Memory cgroup out of memory: Killed process 43622 (sh) total-vm:136808kB, anon-rss:62252kB, file-rss:904kB, shmem-rss:0kB, UID:1000 pgtables:300kB oom_score_adj:200
```

The process was using about 62 MB of resident memory (`anon-rss`) when it hit the 64 MB limit, and that is when it was killed.

> [!NOTE]
> Reading the kernel log needs access to the journal: on many systems an ordinary user must be in the `systemd-journal` group (or `adm`), or use `dmesg` if the system allows it (`sysctl kernel.dmesg_restrict` is `0`). Without access, `podman inspect` and exit code 137 are enough to complete the lab; the kernel line is confirmation.

> [!NOTE]
> If the out-of-memory process is started with `podman exec` in a container whose main process is fine, only that `exec`ed process is killed: the container keeps running, and `OOMKilled` stays `false`. The cgroup's `memory.events` file shows it anyway, as a counter `oom_kill 1`. When you troubleshoot a restart or a kill, look at `memory.events` as well as `OOMKilled`.

Now fix it. The job needs about 200 MB, so raise the limit to 512 MB. This time, use `--rm`:

```bash
podman rm lab-virt-oom
podman run --rm --name lab-virt-oom --memory 512m lab-virt-hello:1.0 \
  sh -c 'x=$(head -c 200000000 /dev/zero | tr "\0" a); echo "allocated ${#x} bytes"'
echo "exit code: $?"
```

```text
lab-virt-oom
allocated 200000000 bytes
exit code: 0
```

The same command succeeds when the limit fits the real need. The first line is the output of `podman rm`, which prints the name of the removed container.

## Verification
Check each result. All of the following should be true:

- `podman history lab-virt-hello:1.0` shows a base layer of about 8 MB, a `RUN` layer of about 1 MB, and a `COPY` layer of a few kB; `CMD` and `LABEL` show `0B`.
- Inside a container, `hostname` differs from the host's, `ps` shows `sleep` as PID 1, and `uname -r` equals the host's kernel version.
- `readlink /proc/<pid>/ns/...` gives different numbers for `cgroup`, `ipc`, `mnt`, `net`, `pid`, `user` and `uts`, and the same number for `time`.
- `memory.max` is `67108864` and `cpu.max` is `50000 100000` for `lab-virt-limited`.
- The OOM run ends with `OOMKilled=true` and exit code 137, and the retry with `--memory 512m` ends with `allocated 200000000 bytes`.

Quick self-check:
```bash
podman ps -a --filter name=lab-virt- --format '{{.Names}} {{.Status}}'
```

After Step 10 this prints nothing, because the last container used `--rm` and the earlier ones were removed.

## Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| `stat -fc %T /sys/fs/cgroup` prints `tmpfs` | The system uses cgroups v1, where rootless limits are not supported | Use a distribution with cgroups v2 (Fedora, Ubuntu 22.04 or later, Debian 11 or later) or a VM. Podman warns: `Resource limits are not supported and ignored on cgroups V1 rootless systems`. |
| `podman run --cpus 0.5` fails or the `cpu.max` file stays at `max` | The `cpu` controller is not delegated to your user | Run `cat /sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers`; it should list `cpu`, `memory` and `pids`. On older systems an administrator must enable delegation (a systemd drop-in with `Delegate=cpu cpuset io memory pids`). |
| `Error: pulling image ... connection refused` or timeout | No Internet or a proxy | Set the `HTTPS_PROXY` variable, or pull from a registry you can reach and change the `FROM` line. |
| `apk add` fails during the build | The container has no DNS or network | Check that `podman run --rm docker.io/library/alpine:3.20.10 nslookup example.com` works; check your firewall and VPN. |
| `cannot clone: Operation not permitted` or user-namespace errors | Rootless needs `/etc/subuid` and `/etc/subgid` entries and unprivileged user namespaces | `grep $USER /etc/subuid /etc/subgid`; an administrator can add them (`usermod --add-subuids ...`). |
| The container runs but `OOMKilled` is `false` and exit code is 137 | Killed for another reason (for example a stop timeout), or the memory limit was not applied | Check `memory.max` in the cgroup; see Step 10. |
| No OOM line in `journalctl -k` | No permission to read the kernel log, or the entry is older than the `--since` window | See the NOTE in Step 10; use `--since "-10min"`. |
| `/proc/<pid>/ns` or the cgroup path doesn't exist | The container already stopped, or the PID is stale | Run `podman ps` and read the PID again. |
| `Error: creating container storage: the container name "lab-virt-oom" is already in use` | A stopped container with that name is left over | `podman rm lab-virt-oom` |

## Challenge (optional)
Use these without step-by-step instructions:
1. Start a container with `--pids-limit 20` and try to start more than 20 processes in it (for example with a shell loop that runs `sleep 300 &`). What error do you get, and which cgroup file and counter changed? Remove the container afterwards.
2. Start a container with `--uts=host`, and then with `--pid=host`, and compare `hostname` and `ps` with the default. Which isolation did you remove in each case? Why would you rarely want this?
3. Build the image again with `FROM docker.io/library/alpine:3.20.10@sha256:<digest>` (get the digest with `podman image inspect docker.io/library/alpine:3.20.10 --format '{{.Digest}}'`). What does the digest guarantee that the tag doesn't?

## Cleanup
Remove the containers (the names are explicit, and `--ignore` skips those that are already gone), the image you built, and the lab folder:

```bash
podman rm -f -t 0 --ignore lab-virt-demo lab-virt-limited lab-virt-oom lab-virt-hello
podman rmi lab-virt-hello:1.0
cd ~ && rm -r ~/virt-lab
```

Expected output (IDs differ; the first command prints the name of every container it removes, and nothing if none is left):
```text
Untagged: localhost/lab-virt-hello:1.0
Deleted: de5c993d6a996bcc2d734c27e4290c4d4d80a12865dc8c7833be391f7e51feb6
Deleted: 964fed8bd61ca0b105dcbf80de33b5c8eb7bab12ab5f96fa46d4d98e2830587a
Deleted: c76c408b748b1e099ea7e4d5e1350499b7d405187fe91f6d497e686e4688fba6
Deleted: b1be2b84c1863941b122d42738aeef7356b81e3f2704e6db0b2faa6f099e28f3
```

If you pulled the base image only for this lab, remove it too. Skip this if you use Alpine 3.20.10 for something else; Podman refuses to remove an image that a container still uses:

```bash
podman rmi docker.io/library/alpine:3.20.10
```

Check that nothing is left:
```bash
podman ps -a --filter name=lab-virt-
podman images lab-virt-hello
ls ~/virt-lab
```

The first two commands print only their header lines (or nothing), and `ls` reports that the folder doesn't exist.

## What you learned
- A `Containerfile` becomes an OCI image made of layers: each `RUN` and `COPY` adds one, and `CMD` and `LABEL` add only metadata. Pinning the base image to an exact tag keeps builds repeatable.
- A container is an ordinary host process: `podman top` shows its host PID, `/proc/<pid>/ns` shows that it sits in its own pid, net, mnt, uts, ipc, user and cgroup namespaces, and `uname -r` shows it shares the host kernel.
- In a rootless container, root inside is your own unprivileged user outside, through the user namespace mapping.
- `--memory` and `--cpus` become `memory.max` and `cpu.max` in the container's cgroup; going over the CPU limit throttles, and going over the memory limit invokes the OOM killer.
- Exit code 137 means `SIGKILL`; `OOMKilled=true`, the kernel log line and `memory.events` tell you whether the OOM killer did it, and the fix is to understand the real memory need, not just to raise the limit.
