See the limits your containers are actually hitting
Container Basics On Linux (Namespaces/Cgroups)
See the limits your containers are actually hitting
🧩 The Challenge
Dealing with a container that keeps getting killed by the OOM killer is infuriating when you think you gave it plenty of memory. You stare at the docker run command and swear the limit was set correctly, but the process just vanishes without a trace.
💡 The Fix
Dig into the cgroup files directly on the host to see what the kernel actually sees, rather than trusting the abstraction layer. This cuts through the noise and shows you the hard limits applied to the process slice.
cat /sys/fs/cgroup/memory/docker/<container_id>/memory.limit_in_bytes
cat /sys/fs/cgroup/memory/docker/<container_id>/memory.usage_in_bytes
⚙️ Why It Works
Kernel interfaces under /sys/fs/cgroup are the source of truth for every constraint currently enforced on your processes. Peeking in here tells you exactly how much breathing room your app has before the kernel pulls the plug.
🚀 Pro-Tip: Check memory.failcnt to see if your container is hitting that limit more often than your monitoring dashboard admits.
Linux Tips & Tricks | © ngelinux.com | 11/26/2026
