From 9975a573a17d3278cc0ce63684329aafeb41e707 Mon Sep 17 00:00:00 2001 From: Sparsh Garg <76697238+SparshGarg999@users.noreply.github.com> Date: Sat, 11 Jul 2026 10:26:32 +0530 Subject: [PATCH] connhelper: return original daemonURL for ssh host This fixes issue #6164 where DaemonHost() returns the hardcoded http://docker.example.com dummy URL for SSH transport connection helpers. Returning the original daemonURL resolves incorrect host reporting and allows proper proxy key/NO_PROXY matching for SSH endpoints. Signed-off-by: Sparsh Garg <76697238+SparshGarg999@users.noreply.github.com> --- cli/connhelper/connhelper.go | 2 +- cli/connhelper/connhelper_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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") +}