Stop wondering which namespace your process is actually living in
Container Basics On Linux (Namespaces/Cgroups)
Stop wondering which namespace your process is actually living in
🧩 The Challenge
You’re staring at a process list inside a container and you swear it’s a PID 1, but then you grep the host and see the same PID doing something else entirely. It’s confusing as hell when you’re trying to debug an environment that feels like a hall of mirrors.
💡 The Fix
Just check the inode numbers for the namespaces of your process; if the host and the container show different numbers for the same namespace, you’ll know exactly where the boundary sits. It saves you from guessing if you’re looking at the right isolation context.
ls -l /proc/<PID>/ns/
⚙️ Why It Works
Each entry in that directory is a symlink to a unique namespace inode, so if the target inode matches the host’s entries in the same path, you’re not actually isolated.
🚀 Pro-Tip: Use readlink to extract just the ID string if you’re trying to compare ten containers at once.
Linux Tips & Tricks | © ngelinux.com | 7/20/2026
