Skip to content

Commit

Permalink
Merge pull request #7388 from tstromberg/none-root-check2
Browse files Browse the repository at this point in the history
none: check for docker and root uid
  • Loading branch information
tstromberg authored Apr 2, 2020
2 parents 37a9810 + 4ace23c commit a305b65
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pkg/minikube/registry/drvs/none/none.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package none
import (
"fmt"
"os/exec"
"os/user"

"github.com/docker/machine/libmachine/drivers"
"k8s.io/minikube/pkg/drivers/none"
Expand Down Expand Up @@ -51,9 +52,22 @@ func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
}

func status() registry.State {
_, err := exec.LookPath("systemctl")
if err != nil {
if _, err := exec.LookPath("systemctl"); err != nil {
return registry.State{Error: err, Fix: "Use a systemd based Linux distribution", Doc: "https://minikube.sigs.k8s.io/docs/reference/drivers/none/"}
}

if _, err := exec.LookPath("docker"); err != nil {
return registry.State{Error: err, Installed: false, Fix: "Install docker", Doc: "https://minikube.sigs.k8s.io/docs/reference/drivers/none/"}
}

u, err := user.Current()
if err != nil {
return registry.State{Error: err, Healthy: false, Doc: "https://minikube.sigs.k8s.io/docs/reference/drivers/none/"}
}

if u.Uid != "0" {
return registry.State{Error: fmt.Errorf("the 'none' driver must be run as the root user"), Healthy: false, Fix: "For non-root usage, try the newer 'docker' driver", Installed: true}
}

return registry.State{Installed: true, Healthy: true}
}

0 comments on commit a305b65

Please sign in to comment.