diff --git a/cli/main.go b/cli/main.go index 3ce8b3d10..02e15ec41 100644 --- a/cli/main.go +++ b/cli/main.go @@ -212,7 +212,7 @@ func main() { compose.Command(ctype), volume.Command(ctype), ) - if ctype == store.LocalContextType { + if ctype == store.DefaultContextType || ctype == store.LocalContextType { if len(opts.Hosts) > 0 { opts.Context = "" currentContext = "default" diff --git a/local/e2e/cli-only/e2e_test.go b/local/e2e/cli-only/e2e_test.go index 09aac2031..d02338267 100644 --- a/local/e2e/cli-only/e2e_test.go +++ b/local/e2e/cli-only/e2e_test.go @@ -396,15 +396,14 @@ func TestLegacy(t *testing.T) { }) t.Run("host flag", func(t *testing.T) { - stderr := "dial tcp: lookup nonexistent" - if runtime.GOOS == "windows" { - stderr = "dial tcp: lookup nonexistent: no such host" - } + stderr := []string{"dial tcp: lookup nonexistent", "no such host"} res := c.RunDockerOrExitError("-H", "tcp://nonexistent:123", "version") res.Assert(t, icmd.Expected{ ExitCode: 1, }) - assert.Assert(t, strings.Contains(res.Stderr(), stderr), res.Stderr()) + for _, s := range stderr { + assert.Assert(t, strings.Contains(res.Stderr(), s), res.Stderr()) + } }) t.Run("existing contexts delegate", func(t *testing.T) {