Stop guessing which namespace your container process is actually using

Container Basics On Linux (Namespaces/Cgroups)

Stop guessing which namespace your container process is actually using

🧩 The Challenge

Trying to figure out if your containerized app is actually isolated or just sitting in the host’s network stack is a nightmare when you’re mid-incident. I’ve spent way too much time hunting for processes only to realize I was looking at the wrong layer of abstraction.

💡 The Fix

Use the readlink command on the proc filesystem to peek at the inode numbers for each namespace type. It’s the only way to know for sure if two processes are sitting in the same namespace or if the container runtime lied to you.

readlink /proc/$(pgrep -f your_app_name)/ns/net

⚙️ Why It Works

Since Linux represents namespaces as files under /proc/PID/ns, checking the inode number lets you instantly see if processes share the same network, PID, or mount environment. If those numbers match, they’re in the same bucket.

🚀 Pro-Tip: Pipe it into ls -l to see the inode numbers for all namespaces at once and save your sanity.

Linux Tips & Tricks | © ngelinux.com | 11/8/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted