diff --git a/cmd/minikube/cmd/docker-env.go b/cmd/minikube/cmd/docker-env.go index 94677f22287d..83858724b600 100644 --- a/cmd/minikube/cmd/docker-env.go +++ b/cmd/minikube/cmd/docker-env.go @@ -252,8 +252,7 @@ var dockerEnvCmd = &cobra.Command{ sh := shell.EnvConfig{ Shell: shl, } - cname := ClusterFlagValue() - co := mustload.Running(cname) + if dockerUnset { if err := dockerUnsetScript(DockerEnvConfig{EnvConfig: sh}, os.Stdout); err != nil { exit.Error(reason.InternalEnvScript, "Error generating unset output", err) @@ -266,6 +265,9 @@ var dockerEnvCmd = &cobra.Command{ exit.SetShell(true) } + cname := ClusterFlagValue() + co := mustload.Running(cname) + driverName := co.CP.Host.DriverName if driverName == driver.None { diff --git a/go.sum b/go.sum index a5c8313f3538..ae446773c437 100644 --- a/go.sum +++ b/go.sum @@ -740,6 +740,7 @@ github.com/opencontainers/selinux v1.3.1-0.20190929122143-5215b1806f52/go.mod h1 github.com/otiai10/copy v1.5.0 h1:SoXDGnlTUZoqB/wSuj/Y5L6T5i6iN4YRAcMCd+JnLNU= github.com/otiai10/copy v1.5.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index 7a54b317635c..2513552a3304 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -262,6 +262,10 @@ func validateDockerEnv(ctx context.Context, t *testing.T, profile string) { // we should be able to get minikube status with a bash which evaled docker-env rr, err = Run(t, c) } + got := Status(mctx, t, Target(), profile, "DockerEnv", profile) + if got != "in-use" { + t.Errorf("expected status after eval-ing docker-env to be -%q- but got *%q*", "in-use", got) + } if mctx.Err() == context.DeadlineExceeded { t.Errorf("failed to run the command by deadline. exceeded timeout. %s", rr.Command()) }