Site icon New Generation Enterprise Linux

Peek under the hood of your container cgroups without the headache

Container Basics On Linux (Namespaces/Cgroups)

Peek under the hood of your container cgroups without the headache

đź§© The Challenge

Trying to figure out why a pod keeps hitting a memory limit is a nightmare when you’re just looking at a wall of YAML. I’ve spent way too many nights guessing which cgroup file the kernel is actually enforcing.

đź’ˇ The Fix

Skip the high-level orchestration tools and look directly at the sysfs entries the kernel manages. It’s the only way to see the raw numbers the OOM killer is looking at.

findmnt -no TARGET | grep cgroup
cat /sys/fs/cgroup/memory/system.slice/docker-<container_id>.scope/memory.usage_in_bytes

⚙️ Why It Works

By navigating directly to the cgroup hierarchy, you bypass the abstraction layers that usually hide the actual resource accounting. Everything in Linux is a file, and the kernel exposes these performance metrics exactly where you’d expect.

🚀 Pro-Tip: Pipe that output into numfmt –to=iec-i if you’re tired of counting trailing zeros on those byte values.

Linux Tips & Tricks | © ngelinux.com | 10/17/2026

0 0 votes
Article Rating
Exit mobile version