mirror of https://github.com/docker/docs.git
Add CheckKernelVersion so we can check any specific version
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
7ec7173b76
commit
87959dbfac
|
@ -63,6 +63,17 @@ func parseSecurityOpt(container *Container, config *runconfig.HostConfig) error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CheckKernelVersion(k, major, minor int) bool {
|
||||||
|
if v, err := kernel.GetKernelVersion(); err != nil {
|
||||||
|
logrus.Warnf("%s", err)
|
||||||
|
} else {
|
||||||
|
if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: k, Major: major, Minor: minor}) < 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func checkKernel() error {
|
func checkKernel() error {
|
||||||
// Check for unsupported kernel versions
|
// Check for unsupported kernel versions
|
||||||
// FIXME: it would be cleaner to not test for specific versions, but rather
|
// FIXME: it would be cleaner to not test for specific versions, but rather
|
||||||
|
@ -71,13 +82,10 @@ func checkKernel() error {
|
||||||
// without actually causing a kernel panic, so we need this workaround until
|
// without actually causing a kernel panic, so we need this workaround until
|
||||||
// the circumstances of pre-3.10 crashes are clearer.
|
// the circumstances of pre-3.10 crashes are clearer.
|
||||||
// For details see https://github.com/docker/docker/issues/407
|
// For details see https://github.com/docker/docker/issues/407
|
||||||
if k, err := kernel.GetKernelVersion(); err != nil {
|
if !CheckKernelVersion(3, 10, 0) {
|
||||||
logrus.Warnf("%s", err)
|
v, _ := kernel.GetKernelVersion()
|
||||||
} else {
|
if os.Getenv("DOCKER_NOWARN_KERNEL_VERSION") == "" {
|
||||||
if kernel.CompareKernelVersion(*k, kernel.VersionInfo{Kernel: 3, Major: 10, Minor: 0}) < 0 {
|
logrus.Warnf("Your Linux kernel version %s can be unstable running docker. Please upgrade your kernel to 3.10.0.", v.String())
|
||||||
if os.Getenv("DOCKER_NOWARN_KERNEL_VERSION") == "" {
|
|
||||||
logrus.Warnf("You are running linux kernel version %s, which might be unstable running docker. Please upgrade your kernel to 3.10.0.", k.String())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue