From a71fd954ddab5eff36bec658f6d0d64ca2d23e41 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Dec 2025 22:55:12 +0000 Subject: [PATCH] Fix Docker API version compatibility by enabling proper version negotiation Replace client.FromEnv with individual options to avoid WithVersionFromEnv which prevents API version negotiation when DOCKER_API_VERSION is set Co-authored-by: jesseduffield <8456633+jesseduffield@users.noreply.github.com> --- pkg/commands/docker.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/commands/docker.go b/pkg/commands/docker.go index 35afef2f..be864e5d 100644 --- a/pkg/commands/docker.go +++ b/pkg/commands/docker.go @@ -96,7 +96,16 @@ func NewDockerCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Translat dockerHost = dockerHostFromEnv } - cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation(), client.WithHost(dockerHost)) + // We avoid using client.FromEnv because it includes WithVersionFromEnv() which + // sets manualOverride=true when DOCKER_API_VERSION is set, preventing API version + // negotiation even when WithAPIVersionNegotiation() is specified. + // Instead, we manually configure TLS and host from environment, but always enable + // API version negotiation to support older Docker daemons. + cli, err := client.NewClientWithOpts( + client.WithTLSClientConfigFromEnv(), + client.WithAPIVersionNegotiation(), + client.WithHost(dockerHost), + ) if err != nil { ogLog.Fatal(err) }