From 9b23841ee3a0e6852050502d8bc7e119f01ed68b Mon Sep 17 00:00:00 2001 From: Daehyeok Mun Date: Fri, 19 Mar 2021 09:39:25 -0700 Subject: [PATCH] Add solution message if Docker is rootless --- cmd/minikube/cmd/start.go | 2 +- pkg/drivers/kic/oci/info.go | 10 +++++++++- pkg/minikube/registry/drvs/docker/docker.go | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index abc8d44e21..fba12bcb7d 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -747,7 +747,7 @@ func validateDriver(ds registry.DriverState, existing *config.ClusterConfig) { } r := reason.MatchKnownIssue(reason.Kind{}, st.Error, runtime.GOOS) - if r.ID != "" { + if r != nil && r.ID != "" { exitIfNotForced(*r, st.Error.Error()) } diff --git a/pkg/drivers/kic/oci/info.go b/pkg/drivers/kic/oci/info.go index b57492533e..06f423eb74 100644 --- a/pkg/drivers/kic/oci/info.go +++ b/pkg/drivers/kic/oci/info.go @@ -32,6 +32,7 @@ type SysInfo struct { TotalMemory int64 // TotalMemory Total available ram OSType string // container's OsType (windows or linux) Swarm bool // Weather or not the docker swarm is active + Rootless bool // Weather or not the docker is running on rootless mode StorageDriver string // the storage driver for the daemon (for example overlay2) Errors []string // any server issues } @@ -62,7 +63,14 @@ func DaemonInfo(ociBin string) (SysInfo, error) { return *cachedSysInfo, err } d, err := dockerSystemInfo() - cachedSysInfo = &SysInfo{CPUs: d.NCPU, TotalMemory: d.MemTotal, OSType: d.OSType, Swarm: d.Swarm.LocalNodeState == "active", StorageDriver: d.Driver, Errors: d.ServerErrors} + rootless := false + for _, se := range d.SecurityOptions { + if strings.HasPrefix(se, "name=rootless") { + rootless = true + break + } + } + cachedSysInfo = &SysInfo{CPUs: d.NCPU, TotalMemory: d.MemTotal, OSType: d.OSType, Swarm: d.Swarm.LocalNodeState == "active", Rootless: rootless, StorageDriver: d.Driver, Errors: d.ServerErrors} return *cachedSysInfo, err } diff --git a/pkg/minikube/registry/drvs/docker/docker.go b/pkg/minikube/registry/drvs/docker/docker.go index fce146e48a..8ef0fdb35d 100644 --- a/pkg/minikube/registry/drvs/docker/docker.go +++ b/pkg/minikube/registry/drvs/docker/docker.go @@ -131,6 +131,15 @@ func status() registry.State { return suggestFix("info", -1, serr, fmt.Errorf("docker info error: %s", serr)) } + if si.Rootless { + return registry.State{ + Reason: "PROVIDER_DOCKER_ROOTLESS", + Error: errors.New("rootless Docker not supported yet"), + Installed: true, + Healthy: false, + Doc: "https://github.com/kubernetes/minikube/issues/10836"} + } + return checkNeedsImprovement() }