Container Basics On Linux (Namespaces/Cgroups)
Stop losing your mind over unkillable orphaned cgroup processes
đź§© The Challenge
You’ve shut down a container, but the host is still reporting it’s using half your RAM and I’ve spent way too many nights hunting down zombie processes trapped in a stale cgroup. It’s infuriating when the kernel thinks a task is still active even though it isn’t responding to anything you throw at it.
đź’ˇ The Fix
Instead of guessing why a service won’t die, you can manually force the system to clean up the cgroup hierarchy by poking the kernel to flush those dead processes out. It clears the decks so you can finally restart your app without a full reboot.
echo 1 > /sys/fs/cgroup/memory/your_container_name/cgroup.procs
⚙️ Why It Works
Writing a 1 into that cgroup.procs file forces the kernel to migrate any remaining PIDs out of the control group, effectively dissolving the stubborn directory so you can actually delete it.
🚀 Pro-Tip: Use lsof to check if any hidden log handles are still keeping those processes alive before you try to kill them.
Linux Tips & Tricks | © ngelinux.com | 9/15/2026
