diff --git a/cli/connhelper/connhelper.go b/cli/connhelper/connhelper.go index 8d97a2a40b7f..6efb120e436a 100644 --- a/cli/connhelper/connhelper.go +++ b/cli/connhelper/connhelper.go @@ -65,7 +65,7 @@ func getConnectionHelper(daemonURL string, sshFlags []string) (*ConnectionHelper Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) { return commandconn.New(ctx, "ssh", sshArgs...) }, - Host: "http://docker.example.com", + Host: daemonURL, }, nil } // Future version may support plugins via ~/.docker/config.json. e.g. "dind" diff --git a/cli/connhelper/connhelper_test.go b/cli/connhelper/connhelper_test.go index 66d2487c3423..2a8fc080550c 100644 --- a/cli/connhelper/connhelper_test.go +++ b/cli/connhelper/connhelper_test.go @@ -61,3 +61,10 @@ func TestDisablePseudoTerminalAllocation(t *testing.T) { }) } } + +func TestGetConnectionHelper(t *testing.T) { + helper, err := GetConnectionHelper("ssh://user@1.2.3.4") + assert.NilError(t, err) + assert.Assert(t, helper != nil) + assert.Equal(t, helper.Host, "ssh://user@1.2.3.4") +}