How to change the cgroup driver from cgroupfs systemd in docker?

Spread the Knowledge
  • How to change the cgroup driver from cgroupfs to systemd in RHEL/Centos?
  • How to change the cgroup driver from cgroupfs to systemd in Ubuntu

Resolving the problem
Change the Docker cgroup to systemd by editing the Docker service with the following command:

$ systemctl status docker
Check following section 
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)

$ vi /usr/lib/systemd/system/docker.service
Modify this line
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
To
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --exec-opt native.cgroupdriver=systemd

#Restart the Docker service by running the following command:
$ systemctl daemon-reload
$ systemctl restart docker

# Verify the cgroups driver to systemd
$ docker info

Rajesh Kumar
Latest posts by Rajesh Kumar (see all)