Skip to content

Commit

Permalink
none: check for docker and root
Browse files Browse the repository at this point in the history
  • Loading branch information
tstromberg committed Apr 2, 2020
1 parent f3392f4 commit 6276c1c
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 6276c1c

Please sign in to comment.