Container Basics On Linux (Namespaces/Cgroups)
See exactly which process is trapped in what namespace
đź§© The Challenge
Trying to figure out why a process inside a container isn’t seeing the network interface you swear you attached is a nightmare when you’re just staring at a PID. You end up digging through layers of abstraction, wishing you could just peek into the container’s head.
đź’ˇ The Fix
Use the lsns command to list all active namespaces and then filter by process ID to see which specific buckets your application is actually sitting in. It’s way faster than guessing which cgroup or shim is causing the visibility gap.
lsns -p <PID>
⚙️ Why It Works
This utility walks the /proc filesystem to translate raw namespace handles into human-readable types like mnt, net, and uts. It’s the only way to verify if your process is actually living in the namespace you think it is.
🚀 Pro-Tip: Run it as root so you don’t get empty results for namespaces owned by processes you don’t strictly “own” yourself.
Linux Tips & Tricks | © ngelinux.com | 9/10/2026
