mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Do not stop execution if cgroup mountpoint is not found
This commit is contained in:
parent
965e8a02d2
commit
71b5806614
2 changed files with 16 additions and 13 deletions
26
runtime.go
26
runtime.go
|
@ -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
|
||||
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.")
|
||||
}
|
||||
}
|
||||
|
||||
_, 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
|
||||
|
||||
return runtime, nil
|
||||
}
|
||||
|
||||
|
|
3
utils.go
3
utils.go
|
@ -503,7 +503,6 @@ func FindCgroupMountpoint(cgroupType string) (string, error) {
|
|||
if len(r) == 2 {
|
||||
return r[1], nil
|
||||
}
|
||||
fmt.Printf("line: %s (%d)\n", line, len(r))
|
||||
}
|
||||
return "", fmt.Errorf("cgroup mountpoint not found")
|
||||
return "", fmt.Errorf("cgroup mountpoint not found for %s", cgroupType)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue