From b3649f4065984d16d2834b33f3f2d9f79c92603e Mon Sep 17 00:00:00 2001 From: Darren Stahl Date: Wed, 19 Apr 2017 16:41:59 -0700 Subject: [PATCH] Prevent a non-zero NanoCPUs from setting a zero CPU.Count Signed-off-by: Darren Stahl --- daemon/oci_windows.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/oci_windows.go b/daemon/oci_windows.go index 85e2a9bc14..b00c714bd1 100644 --- a/daemon/oci_windows.go +++ b/daemon/oci_windows.go @@ -92,6 +92,11 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) { } } else { cpuPercent = uint8(c.HostConfig.NanoCPUs * 100 / int64(sysinfo.NumCPU()) / 1e9) + + if cpuPercent < 1 { + // The requested NanoCPUs is so small that we rounded to 0, use 1 instead + cpuPercent = 1 + } } } memoryLimit := uint64(c.HostConfig.Memory)