Container Basics On Linux (Namespaces/Cgroups)
Stop worrying if your container really sees the host network
đ§© The Challenge
Youâve probably spent hours debugging why your container canât talk to a local service, only to realize you accidentally stuck it in a completely different network namespace. Itâs a classic headache that makes you feel like youâre losing your mind when local ports just vanish.
đĄ The Fix
Use nsenter to dive into the specific namespace of your container and check the routing table exactly how the container sees it. It saves you from having to guess whatâs going on behind the abstraction layer.
nsenter -t $(docker inspect -f '{{.State.Pid}}' <container_name>) -n ip addr
âïž Why It Works
By grabbing the PID of the containerâs process, this command forces your shell into the containerâs network namespace instead of the hostâs, letting you see the interface configuration firsthand.
đ Pro-Tip: Alias this to something short like ânenterâ if youâre doing a lot of deep-dive debugging on production clusters.
Linux Tips & Tricks | © ngelinux.com | 10/28/2026
