Преглед на файлове

Check nil before set resource.OomKillDisable

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Lei Jitang преди 9 години
родител
ревизия
09a33b5f60
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      daemon/container_operations_unix.go

+ 3 - 1
daemon/container_operations_unix.go

@@ -208,10 +208,12 @@ func (daemon *Daemon) populateCommand(c *container.Container, env []string) erro
 		BlkioThrottleWriteBpsDevice:  writeBpsDevice,
 		BlkioThrottleWriteBpsDevice:  writeBpsDevice,
 		BlkioThrottleReadIOpsDevice:  readIOpsDevice,
 		BlkioThrottleReadIOpsDevice:  readIOpsDevice,
 		BlkioThrottleWriteIOpsDevice: writeIOpsDevice,
 		BlkioThrottleWriteIOpsDevice: writeIOpsDevice,
-		OomKillDisable:               *c.HostConfig.OomKillDisable,
 		MemorySwappiness:             -1,
 		MemorySwappiness:             -1,
 	}
 	}
 
 
+	if c.HostConfig.OomKillDisable != nil {
+		resources.OomKillDisable = *c.HostConfig.OomKillDisable
+	}
 	if c.HostConfig.MemorySwappiness != nil {
 	if c.HostConfig.MemorySwappiness != nil {
 		resources.MemorySwappiness = *c.HostConfig.MemorySwappiness
 		resources.MemorySwappiness = *c.HostConfig.MemorySwappiness
 	}
 	}