From b9e15efde0538452ce1a65b3e5e8afd6ffb14c79 Mon Sep 17 00:00:00 2001 From: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Date: Fri, 29 Aug 2025 14:31:21 +0200 Subject: [PATCH] return early if GODEBUG set or context is default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> (cherry picked from commit 72f79333e54b14c5a3309655d3b408352dc92078) Signed-off-by: Paweł Gronowski --- cli/command/cli.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cli/command/cli.go b/cli/command/cli.go index d11961e61b..85fac56502 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -282,6 +282,12 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...CLIOption) } filterResourceAttributesEnvvar() + // early return if GODEBUG is already set or the docker context is + // the default context, i.e. is a virtual context where we won't override + // any GODEBUG values. + if v := os.Getenv("GODEBUG"); cli.currentContext == DefaultContextName || v != "" { + return nil + } meta, err := cli.contextStore.GetMetadata(cli.currentContext) if err == nil { setGoDebug(meta)