Skip to content

Commit e801b47

Browse files
authored
Merge pull request #3698 from afbjorklund/docker-env
Improve reporting when docker host/service is down
2 parents c728dde + 637e71f commit e801b47

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/minikube/cmd/env.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/docker/machine/libmachine"
2929
"github.com/docker/machine/libmachine/host"
3030
"github.com/docker/machine/libmachine/shell"
31+
"github.com/docker/machine/libmachine/state"
3132
"github.com/pkg/errors"
3233
"github.com/spf13/cobra"
3334
"k8s.io/minikube/pkg/minikube/cluster"
@@ -319,9 +320,16 @@ var dockerEnvCmd = &cobra.Command{
319320
if host.Driver.DriverName() == "none" {
320321
exit.Usage(`'none' driver does not support 'minikube docker-env' command`)
321322
}
323+
hostSt, err := cluster.GetHostStatus(api)
324+
if err != nil {
325+
exit.WithError("Error getting host status", err)
326+
}
327+
if hostSt != state.Running.String() {
328+
exit.WithCode(exit.Unavailable, `The docker host is currently not running`)
329+
}
322330
docker, err := GetDockerActive(host)
323331
if !docker {
324-
exit.WithCode(exit.Unavailable, `# The docker service is currently not active`)
332+
exit.WithCode(exit.Unavailable, `The docker service is currently not active`)
325333
}
326334

327335
var shellCfg *ShellConfig

0 commit comments

Comments
 (0)