Container Basics On Linux (Namespaces/Cgroups)
See which process is actually holding the keys to your namespace
đź§© The Challenge
Trying to figure out why a container keeps failing to start because of a socket collision is a nightmare when you can’t tell which process owns the underlying namespace. I’ve wasted half an afternoon restarting services only to realize the namespace ID was tied to a zombie process I hadn’t even noticed yet.
đź’ˇ The Fix
Use the lsns command to map out every active namespace on your host and link them to their specific PID. It cuts through the fog and shows you exactly what is hogging your isolation boundaries.
lsns -p <PID>
⚙️ Why It Works
This utility parses the contents of /proc to map out the current process tree relative to its kernel namespaces. By targeting a specific PID, you see the hierarchy without having to guess which cgroup or namespace path the process is sitting in.
🚀 Pro-Tip: Pipe it into grep if you are hunting for a specific net or mnt namespace that won’t release its handle.
Linux Tips & Tricks | © ngelinux.com | 11/22/2026
