☕ XOPSSCHOOL — LEARNING MADE AFFORDABLE
Build the Skills Your Next Career Move Demands.
For the Price of One Coffee a Month.
Why spend hundreds on individual courses? Unlock an entire year of technical learning with one Coffee Pass.
US$4.90 /month
US$58.80/year
₹499 + GST/month
₹5,988 + GST/year
€4.90 /month
€58.80/year
12 Months of Access • Billed Annually • No Automatic Renewal
DevOps • Cloud • SRE • Kubernetes • Terraform • DevSecOps • AI • AIOps • MLOps • LLMOps • FinOps • GitOps • Platform Engineering & Much More
192
Premium Courses
1,085
Video Sessions
99
Ops Disciplines
86
Tool Courses
340
Assignments
227
Quizzes
✓ QR-Verifiable Certificates   ✓ Learn at Your Own Pace   ✓ Hands-on Learning   ✓ New Courses Included
Learn from real-world, instructor-led video sessions by
Rajesh Kumar
Principal Architect • Trainer • Mentor • 15+ Years of Industry Experience
☕ Get My Coffee Pass — Start Learning Today →
One Payment. Every Premium Course. One Full Year.
The best investment you can make is in the person you are becoming.

Docker Tutorials: Docker Cgroup Drivers – Complete Guide

Introduction

Docker uses cgroups (control groups) to manage resource constraints like CPU, memory, and I/O for containers. These cgroups are orchestrated through cgroup drivers that act as an interface between Docker and the Linux kernel.

Understanding Docker’s cgroup drivers is critical for:

  • Optimizing container resource management
  • Integrating container runtime with Kubernetes
  • Debugging container performance problems
  • Ensuring compatibility with modern OS distributions

📋 What Are Cgroup Drivers?

A cgroup driver tells Docker which mechanism to use to allocate and manage resource control groups (cgroups) in the Linux system.

Docker supports two cgroup driver types:

  1. cgroupfs — Docker directly manages cgroups via the kernel’s cgroup filesystem
  2. systemd — Docker delegates cgroup management to systemd, which manages cgroups unified with system services

As of Docker v20+, both are still relevant depending on OS and platform.


🧱 List of Docker Cgroup Drivers

DriverControl ModeSupported Linux Cgroup Versions
cgroupfsDirect via /sys/fs/cgroupcgroup v1 and hybrid v1/v2
systemdDelegated to systemd’s unified hierarchyFully cgroup v2 compliant

🔧 1. cgroupfs Driver

Definition: Docker directly creates and manages cgroups by interacting with the kernel’s cgroup filesystem.

Filesystem structure:

/sys/fs/cgroup/
 ├── cpu/
 ├── memory/
 ├── blkio/
 └── ...

✔️ Pros:

  • Works with systems without systemd (e.g., Alpine, older distros)
  • No systemd overhead
  • Independent cgroup hierarchy — doesn’t rely on OS unit governance

❌ Cons:

  • Container and system services may use different cgroup hierarchies, causing interference
  • Not recommended for Kubernetes — kubelet prefers unified hierarchy
  • Difficult to manage under cgroup v2-only systems

📦 Use Cases:

  • Minimal Linux OS without systemd (e.g., Alpine, some IoT or embedded systems)
  • Isolated, single-node Docker usage

🧭 2. systemd Driver

Definition: Docker delegates cgroup management to systemd, ensuring that containers and system services are part of the same unified hierarchy.

Hierarchy example:

/sys/fs/cgroup/system.slice/docker-<container-id>.scope/
Code language: HTML, XML (xml)

✔️ Pros:

  • Kubernetes recommended driver via cgroupDriver: systemd
  • Prevents conflicting resource handling between services and containers
  • Supports cgroup v2 (unified) by default
  • Integrated with host’s unit management (service-level resource control)

❌ Cons:

  • Requires systemd (not present on Alpine or older distros)
  • Slightly more overhead in cgroup management

📦 Use Cases:

  • Kubernetes clusters
  • Modern Linux systems (Ubuntu 20.04+, RHEL 8+, Debian 11+)
  • Mixed workloads where system services and containers need consistent resource governance

📊 Comparison Summary

Featurecgroupfssystemd
Kubernetes-friendly❌ No✔️ Yes
Works without systemd✔️ Yes❌ No
Unified control system❌ No✔️ Yes
cgroup v2 supportPartialFull
Simplicity✔️ YesModerate
Recommended by Docker?Only for non-systemd hosts✔️ Preferred driver

🛠️ How to Check Which Cgroup Driver You’re Using

For Docker:

docker info | grep -i cgroup

Output example:

Cgroup Driver: systemd
Cgroup Version: 2

For Kubernetes:

kubectl get node -o jsonpath='{.items[0].status.nodeInfo.cgroupDriver}'
Code language: PHP (php)

🧠 Best Practices and Recommendations

  • On Kubernetes clusters: always use systemd cgroup driver (especially with CRI runtimes)
  • On lightweight systems without systemd: use cgroupfs
  • On cgroup v2-only systems (e.g., newer Ubuntu, RHEL): ensure your Docker is using systemd
  • Set cgroup driver consistently across Docker, containerd, and Kubernetes components to avoid mismatch errors

📖 Configure Docker Cgroup Driver

Edit Docker daemon configuration:

sudo vim /etc/docker/daemon.json

Set systemd driver:

{
  "exec-opts": ["native.cgroupdriver=systemd"]
}
Code language: JSON / JSON with Comments (json)

Restart Docker:

sudo systemctl restart docker

🧭 Troubleshooting Common Issues

❌ Error: “cgroup driver conflict”

Occurs when Docker is using cgroupfs while Kubernetes (kubelet) uses systemd.

Fix: Align both to use systemd

❌ Not recognized cgroup v2

Upgrade Docker runtime to v20+ and configure systemd as cgroup driver.


🧩 Summary

Docker supports two primary cgroup drivers — cgroupfs and systemd. The modern recommendation, especially for Kubernetes or systemd-based distributions, is to use systemd as the cgroup driver.

This ensures unified resource control between system services and containers, avoids cgroup conflicts, and fully supports cgroup v2.

ScenarioRecommended Driver
Modern Linux with systemd (Ubuntu, RHEL, Debian)systemd
Kubernetes clusterssystemd
Minimal Linux without systemdcgroupfs
Legacy Docker usage on old OScgroupfs

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals

Related Posts

How to Run Prometheus server as a Service?

To run Prometheus as a service, create a systemd unit file at /etc/systemd/system/prometheus.service that points to the binary by its absolute path, then reload systemd and enable…

Read More

Elastic Agent Commands Reference

Elastic Agent runs as an operating system service, so you start and stop it with systemd on Linux, launchd on macOS and the Service Control Manager on…

Read More

Jira on Linux: Installation and Configuration with Safer Service and Firewall Setup

Learn how to install Jira on Linux using Atlassian’s installer, manage it as a service, and expose port 8080 safely. This revision keeps the original references but updates the process for clearer, production-minded operations.

Read More

MySQL Basic Troubleshooting Guide: Service, Port 3306, Logs, and Crash Repair

This Linux-first runbook helps you troubleshoot common MySQL issues quickly, from startup failures to port conflicts and slow performance. You will learn practical checks for service health, configuration, logging, and table repair.

Read More

RHCSA EX200 Self-Study Curriculum and Hands-On Lab Manual

Gold-standard home-study roadmap for the Red Hat Certified System Administrator (RHCSA) exam EX200 Research cut-off: 2026-10-06 Primary authority: current official Red Hat EX200 page, Red Hat Certification…

Read More

Linux Administrator: Role Blueprint, Responsibilities, Skills, KPIs, and Career Path

The Linux Administrator is responsible for the reliability, security, and day-to-day operational health of Linux-based infrastructure that supports enterprise applications, internal developer platforms, and shared IT services. This role ensures Linux systems are consistently configured, patched, monitored, backed up, and recoverable—while meeting organizational standards for availability, performance, and compliance.

Read More
Subscribe
Notify of
guest
3 Comments
Newest
Oldest Most Voted
Skylar Bennett
Skylar Bennett
1 year ago

This blog post on Docker cgroup drivers provides an in-depth and clear explanation of a fundamental aspect of container management. It effectively breaks down how Docker utilizes cgroups to manage and isolate system resources such as CPU, memory, and I/O, ensuring containers run efficiently and do not interfere with each other. The guide also does a great job of explaining the different cgroup drivers, like cgroupfs and systemd, and how they impact container performance and compatibility with orchestration tools like Kubernetes. This post is incredibly valuable for DevOps professionals and system administrators, especially those working with containerized environments in production. It offers essential insights into resource management and isolation, which are key to maintaining stable and reliable systems. Overall, it’s a must-read for anyone looking to deepen their understanding of Docker’s internal workings and improve their container management skills.

Skylar Bennett
Skylar Bennett
1 year ago

nice

Jason Mitchell
Jason Mitchell
1 year ago

Loved this guide — it explained cgroup drivers in a way that finally made sense to me. Felt like chatting with a friend who actually knows Docker. Seriously, great job on this!

3
0
Would love your thoughts, please comment.x
()
x