提交 c59210e1 编写于 作者: T Thomas Stromberg

Skip overlay module suggestion on distros which do not support kernel modules, like WSL

上级 08d874a4
...@@ -19,6 +19,7 @@ package docker ...@@ -19,6 +19,7 @@ package docker
import ( import (
"context" "context"
"fmt" "fmt"
"os"
"os/exec" "os/exec"
"runtime" "runtime"
"strings" "strings"
...@@ -119,12 +120,20 @@ func status() registry.State { ...@@ -119,12 +120,20 @@ func status() registry.State {
func checkNeedsImprovement() registry.State { func checkNeedsImprovement() registry.State {
if runtime.GOOS == "linux" { if runtime.GOOS == "linux" {
return checkOverlayMod() return checkOverlayMod()
} // TODO #8540: on non-linux check if docker desktop has enough CPU/memory }
return registry.State{Installed: true, Healthy: true} return registry.State{Installed: true, Healthy: true}
} }
// checkOverlayMod checks if // checkOverlayMod checks if
func checkOverlayMod() registry.State { func checkOverlayMod() registry.State {
if os.Getenv("WSL_DISTRO_NAME") != "" {
glog.Infof("Skipping overlay check: WSL does not support kernel modules")
}
if _, err := os.Stat("/lib/modules"); err != nil {
glog.Infof("Skipping overlay check: distribution does not support kernel modules")
}
ctx, cancel := context.WithTimeout(context.Background(), 6*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 6*time.Second)
defer cancel() defer cancel()
cmd := exec.CommandContext(ctx, "modprobe", "overlay") cmd := exec.CommandContext(ctx, "modprobe", "overlay")
...@@ -138,7 +147,7 @@ func checkOverlayMod() registry.State { ...@@ -138,7 +147,7 @@ func checkOverlayMod() registry.State {
return registry.State{NeedsImprovement: true, Installed: true, Healthy: true, Fix: "enable overlayfs kernel module on your Linux"} return registry.State{NeedsImprovement: true, Installed: true, Healthy: true, Fix: "enable overlayfs kernel module on your Linux"}
} }
if err != nil { if err != nil {
glog.Warningf("couldn't verify the linux distro's uname : %s", err) glog.Warningf("couldn't verify the linux distro's uname: %s", err)
return registry.State{NeedsImprovement: true, Installed: true, Healthy: true, Fix: "enable overlayfs kernel module on your Linux"} return registry.State{NeedsImprovement: true, Installed: true, Healthy: true, Fix: "enable overlayfs kernel module on your Linux"}
} }
path := fmt.Sprintf("/lib/modules/%s/modules.builtin", string(out)) path := fmt.Sprintf("/lib/modules/%s/modules.builtin", string(out))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册