Stop hunting for the PID that is hogging your container resources

Container Basics On Linux (Namespaces/Cgroups)

Stop hunting for the PID that is hogging your container resources

🧩 The Challenge

Dealing with a container that is acting like a runaway train is annoying enough, but trying to map those cryptic cgroup paths back to an actual process ID is a nightmare. You end up digging through layers of sysfs entries just to find out which specific script is choking the CPU.

💡 The Fix

Use systemd-cgls to get a tree view of your running processes grouped by their cgroup hierarchy. It saves you from manual path crawling and makes the invisible structure of your containers finally readable.

systemd-cgls /sys/fs/cgroup/cpu/docker

⚙️ Why It Works

This utility parses the nested cgroup directories directly from the kernel filesystem and presents them as a structured hierarchy rather than forcing you to guess which PID belongs to which slice. You get to see the actual parent-child relationships instead of a flat list of garbage.

🚀 Pro-Tip: Pipe it into grep to instantly isolate the specific slice giving you grief.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted