mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
info: report cgroup driver as "none" when running rootless
Previously `docker info` had reported "cgroupfs" as the cgroup driver but the driver wasn't actually used at all. This PR reports "none" as the cgroup driver so as to avoid confusion. e.g. kubeadm/kubelet will detect cgroupless-ness by checking this docker info field. https://github.com/rootless-containers/usernetes/pull/97 Note that user still cannot specify `native.cgroupdriver=none` manually. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
8d760280a2
commit
153466ba0a
1 changed files with 7 additions and 0 deletions
|
@ -73,6 +73,7 @@ const (
|
||||||
// constant for cgroup drivers
|
// constant for cgroup drivers
|
||||||
cgroupFsDriver = "cgroupfs"
|
cgroupFsDriver = "cgroupfs"
|
||||||
cgroupSystemdDriver = "systemd"
|
cgroupSystemdDriver = "systemd"
|
||||||
|
cgroupNoneDriver = "none"
|
||||||
|
|
||||||
// DefaultRuntimeName is the default runtime to be used by
|
// DefaultRuntimeName is the default runtime to be used by
|
||||||
// containerd if none is specified
|
// containerd if none is specified
|
||||||
|
@ -584,6 +585,9 @@ func verifyPlatformContainerResources(resources *containertypes.Resources, sysIn
|
||||||
}
|
}
|
||||||
|
|
||||||
func (daemon *Daemon) getCgroupDriver() string {
|
func (daemon *Daemon) getCgroupDriver() string {
|
||||||
|
if daemon.Rootless() {
|
||||||
|
return cgroupNoneDriver
|
||||||
|
}
|
||||||
cgroupDriver := cgroupFsDriver
|
cgroupDriver := cgroupFsDriver
|
||||||
|
|
||||||
if UsingSystemd(daemon.configStore) {
|
if UsingSystemd(daemon.configStore) {
|
||||||
|
@ -610,6 +614,9 @@ func VerifyCgroupDriver(config *config.Config) error {
|
||||||
if cd == "" || cd == cgroupFsDriver || cd == cgroupSystemdDriver {
|
if cd == "" || cd == cgroupFsDriver || cd == cgroupSystemdDriver {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if cd == cgroupNoneDriver {
|
||||||
|
return fmt.Errorf("native.cgroupdriver option %s is internally used and cannot be specified manually", cd)
|
||||||
|
}
|
||||||
return fmt.Errorf("native.cgroupdriver option %s not supported", cd)
|
return fmt.Errorf("native.cgroupdriver option %s not supported", cd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue