$_ CLI In Depth
Learning progress 0%
case syscalls namespaces cgroups

System Deep-Dive: What a Container Really Is

5 min read Module 17: Syscalls, Namespaces & cgroups Updated Dec 5, 2026
Cheat Sheet
0:00 / 3:12

The scenario

A developer reports that a service running in a container can see processes it should not see, and that a memory limit seems to be ignored. The container runtime is not available on the workstation, but the service is running as a process on a Linux host. The question is what the container actually consists of, and what the kernel has been told to do. The goal is to answer it from the kernel's own records, not from the runtime's configuration file.

Step 1: find the process

A container has an init process that the host sees as an ordinary PID. The first question is which PID that is, and the answer comes from the process table. Tools such as ps list the processes with their parent PIDs, so a container's init shows a parent that belongs to the runtime, not to a login shell.

Once you have a candidate PID, the status file confirms it. Its parent PID, user IDs, and name tell you whether the process is a container init or an ordinary program. A user ID that is not zero on the host, while the process believes it is root, is a sign of a user namespace.

Step 2: compare the namespaces

The namespace links in /proc/PID/ns are the core of the answer. Compare them with the links of your own shell. Every type that matches is shared with the host. Every type that differs is private to the container. A container that shows a different pid link and a different mnt link, but the same net link, has its own process view and mount table and shares the host network stack. That pattern is common, and it explains why the container's processes are hidden from the host shell but its network is not.

BASH1 lines
ls -l /proc/self/ns

Run this in the host shell and in a shell inside the container, then compare the two listings. The comparison is a list of yes and no answers, which you can write down before reading anything else.

Step 3: read the cgroup

The membership file shows the group that the container belongs to. Under cgroups v2 there is one line. The path after the last colon shows the container's group, and the control files in that directory show its limits. The limits are the answer to the memory complaint. If memory.max holds a value, the kernel enforces it, and if it reads max, there is no limit at all. A missing limit explains the complaint without any mystery in the application.

The same reasoning applies to cgroup namespaces. When the cgroup namespace is private, the container sees its own group as the root, so the path it reads looks shorter than the path on the host. Two readers can see different paths for the same group, and both are correct.

Step 4: read the root filesystem

The container's view of the filesystem comes from its mount namespace and its root, which chroot or pivot_root set. The mountinfo file lists what the container can see. A container whose mountinfo lists the host /proc as a bind mount can see host processes through /proc, which breaks the process isolation from step 2. A correct container shows a fresh proc mount and a root that is a directory from its image.

The lab cannot create these mounts, so the exercise is about reading the evidence and recognizing a broken setup. The method is the same on a real host.

Step 5: the system call filter

Namespaces and cgroups do not stop a process from calling a dangerous system call. A seccomp filter does that, and it is attached to the process and inherited by children. The status file has a Seccomp line that shows the mode: 0 for none, 1 for strict, and 2 for a filter. A container that reports mode 2 is filtering calls, and the rules are in the runtime's profile. You can see which calls are blocked by watching for EPERM in an strace run of a failing command.

BASH1 lines
grep Seccomp /proc/self/status

Putting the answer together

The complaint about visible processes is explained by a shared PID namespace or a /proc mount from the host. The complaint about memory is explained by a missing limit in memory.max. Both answers came from /proc, not from the runtime's configuration, which is the point of the exercise: the kernel records what is in effect, and the files show it. A container is ordinary processes with a documented set of settings, and any of them can be checked from a shell.

Step 6: write down what you found

A useful investigation ends with a short record. List the PID, the namespace comparison, the cgroup path and its limit, the mount evidence, and the Seccomp mode. Each entry should name the file it came from, so that another person can repeat the reading. The record also becomes the test plan for a fix: after a change, read the same files again and check that each answer changed in the expected way.

Limits of this method

Reading /proc shows the kernel state for the processes you can see. It cannot show the intent of the runtime, such as a configuration that was meant to set a limit but failed to write it. When the files and the intent disagree, the files win, because they describe what is actually in effect. The disagreement is then a bug to trace, and the trace starts from the files.

What a container really is: namespaces, cgroups and a root

Visualizer

A container is not a special kind of object. It is ordinary processes inside namespaces that limit what they can see, cgroups that limit what they can use, and a root directory of their own.

1 / 4
ls -l /proc/PID/ns, one link per namespace (inode numbers are examples)
cgroupcgroup:[4026531835]
ipcipc:[4026531839]
mntmnt:[4026531841]
netnet:[4026531840]
pidpid:[4026531836]
useruser:[4026531837]
utsuts:[4026531838]

Each process points at one namespace of each kind. Two processes with the same inode number share that namespace. This shell uses the default, host-wide ones.

ls -l /proc/$$/ns
Check yourself Question 1 of 4
Concept Check Seccomp line recall

Which line in /proc/PID/status shows whether seccomp filtering is in effect for a process?

Recap & Key Takeaways

A container is an ordinary process with its own namespaces, a cgroup, a root filesystem, and often a seccomp filter.
Comparing /proc/PID/ns links with your own shell shows which namespaces the container shares with the host.
memory.max in the container's cgroup directory is the enforced limit, and max means no limit is set.
The Seccomp line in /proc/PID/status shows whether the process is filtered, which explains blocked system calls.
Was this lesson helpful? Spot an issue or have a suggestion? Let us know on GitHub.
Report an issue