Skip to content

Commit 8086443

Browse files
committed
docker info: silence unhandleable warnings
The following warnings in `docker info` are now discarded, because there is no action user can actually take. On cgroup v1: - "WARNING: No blkio weight support" - "WARNING: No blkio weight_device support" On cgroup v2: - "WARNING: No kernel memory TCP limit support" - "WARNING: No oom kill disable support" `docker run` still prints warnings when the missing feature is being attempted to use. Signed-off-by: Akihiro Suda <[email protected]>
1 parent 0456e05 commit 8086443

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

daemon/info_unix.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
100100
if !v.SwapLimit {
101101
v.Warnings = append(v.Warnings, "WARNING: No swap limit support")
102102
}
103-
if !v.KernelMemoryTCP {
103+
if !v.KernelMemoryTCP && v.CgroupVersion == "1" {
104+
// kernel memory is not available for cgroup v2.
105+
// Warning is not printed on cgroup v2, because there is no action user can take.
104106
v.Warnings = append(v.Warnings, "WARNING: No kernel memory TCP limit support")
105107
}
106-
if !v.OomKillDisable {
108+
if !v.OomKillDisable && v.CgroupVersion == "1" {
109+
// oom kill disable is not available for cgroup v2.
110+
// Warning is not printed on cgroup v2, because there is no action user can take.
107111
v.Warnings = append(v.Warnings, "WARNING: No oom kill disable support")
108112
}
109113
if !v.CPUCfsQuota {
@@ -122,10 +126,13 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
122126
v.Warnings = append(v.Warnings, "WARNING: Support for cgroup v2 is experimental")
123127
}
124128
// TODO add fields for these options in types.Info
125-
if !sysInfo.BlkioWeight {
129+
if !sysInfo.BlkioWeight && v.CgroupVersion == "2" {
130+
// blkio weight is not available on cgroup v1 since kernel 5.0.
131+
// Warning is not printed on cgroup v1, because there is no action user can take.
132+
// On cgroup v2, blkio weight is implemented using io.weight
126133
v.Warnings = append(v.Warnings, "WARNING: No blkio weight support")
127134
}
128-
if !sysInfo.BlkioWeightDevice {
135+
if !sysInfo.BlkioWeightDevice && v.CgroupVersion == "2" {
129136
v.Warnings = append(v.Warnings, "WARNING: No blkio weight_device support")
130137
}
131138
if !sysInfo.BlkioReadBpsDevice {

0 commit comments

Comments
 (0)