From cecd8e95704479c36ef24c758bcbc51765d5ed78 Mon Sep 17 00:00:00 2001 From: Sergei Khomenkov Date: Sun, 7 Dec 2025 13:52:15 +0200 Subject: [PATCH] commands: fix debug flag in standalone mode The -D/--debug flag was not enabling debug logging in standalone mode. Root cause: debug.Enable() was called before dockerCli.Initialize(), but Initialize() calls SetLogLevel("") which resets logrus level to Info, and since options.Debug was false, it wasn't re-enabled. Fix: Pass opt.debug to options.Debug before Initialize() so it properly enables debug level after SetLogLevel(). Signed-off-by: Sergei Khomenkov --- commands/root.go | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/root.go b/commands/root.go index 7d6b1718c..93815cd92 100644 --- a/commands/root.go +++ b/commands/root.go @@ -57,6 +57,7 @@ func NewRootCmd(name string, isPlugin bool, dockerCli *command.DockerCli) *cobra options := cliflags.NewClientOptions() options.InstallFlags(nflags) options.SetDefaultOptions(nflags) + options.Debug = opt.debug || debug.IsEnabled() return dockerCli.Initialize(options) } return plugin.PersistentPreRunE(cmd, args)