|
@@ -305,18 +305,22 @@ func NewRuntime() (*Runtime, error) {
|
|
|
log.Printf("WARNING: You are running linux kernel version %s, which might be unstable running docker. Please upgrade your kernel to 3.8.0.", k.String())
|
|
|
}
|
|
|
|
|
|
- cgroupMemoryMountpoint, err := FindCgroupMountpoint("memory")
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
- _, err1 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "/memory.limit_in_bytes"))
|
|
|
- _, err2 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.soft_limit_in_bytes"))
|
|
|
- runtime.capabilities.MemoryLimit = err1 == nil && err2 == nil
|
|
|
-
|
|
|
- _, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memeory.memsw.limit_in_bytes"))
|
|
|
- runtime.capabilities.SwapLimit = err == nil
|
|
|
+ if cgroupMemoryMountpoint, err := FindCgroupMountpoint("memory"); err != nil {
|
|
|
+ log.Printf("WARNING: %s\n", err)
|
|
|
+ } else {
|
|
|
+ _, err1 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.limit_in_bytes"))
|
|
|
+ _, err2 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.soft_limit_in_bytes"))
|
|
|
+ runtime.capabilities.MemoryLimit = err1 == nil && err2 == nil
|
|
|
+ if !runtime.capabilities.MemoryLimit {
|
|
|
+ log.Printf("WARNING: Your kernel does not support cgroup memory limit.")
|
|
|
+ }
|
|
|
|
|
|
+ _, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.memsw.limit_in_bytes"))
|
|
|
+ runtime.capabilities.SwapLimit = err == nil
|
|
|
+ if !runtime.capabilities.SwapLimit {
|
|
|
+ log.Printf("WARNING: Your kernel does not support cgroup swap limit.")
|
|
|
+ }
|
|
|
+ }
|
|
|
return runtime, nil
|
|
|
}
|
|
|
|