add check for mod prob

pull/8541/head
Medya Gh 2020-06-23 12:15:57 -07:00
parent f52a682a7e
commit 1101f543d0
2 changed files with 23 additions and 7 deletions

View File

@ -94,7 +94,7 @@ func status() registry.State {
}
if err == nil {
glog.Infof("docker version: %s", output)
return registry.State{Installed: true, Healthy: true}
return checkOverlayMod()
}
glog.Warningf("docker returned error: %v", err)
@ -114,6 +114,21 @@ func status() registry.State {
return registry.State{Error: err, Installed: true, Healthy: false, Doc: docURL}
}
// checkOverlayMod checks if overlay mod is installed on a system
func checkOverlayMod() registry.State {
ctx, cancel := context.WithTimeout(context.Background(), 6*time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, "mod", "probe", "overlay")
_, err := cmd.Output()
if err != nil {
// try a different way
cmd := exec.CommandContext(ctx, "mod", "probe", "overlay")
return registry.State{Error: err, Installed: true, Healthy: false, Fix: "Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker'", Doc: "https://docs.docker.com/engine/install/linux-postinstall/"}
}
return registry.State{Installed: true, Healthy: true}
}
// suggestFix matches a stderr with possible fix for the docker driver
func suggestFix(stderr string, err error) registry.State {
if strings.Contains(stderr, "permission denied") && runtime.GOOS == "linux" {

View File

@ -72,6 +72,7 @@ type StatusChecker func() State
type State struct {
Installed bool
Healthy bool
RoomForImprovement bool
Error error
Fix string
Doc string