Skip to content

commands: fix debug flag in standalone mode#3554

Merged
tonistiigi merged 1 commit intodocker:masterfrom
hsw:fix-debug-standalone
Dec 13, 2025
Merged

commands: fix debug flag in standalone mode#3554
tonistiigi merged 1 commit intodocker:masterfrom
hsw:fix-debug-standalone

Conversation

@hsw
Copy link
Copy Markdown
Contributor

@hsw hsw commented Dec 7, 2025

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().

Test case

Dockerfile

FROM alpine:3.19
MAINTAINER test@example.com

Before (bug):

$ ./docker-buildx -D build .
1 warning found (use docker --debug to expand):

After (fix):

$ ./docker-buildx -D build .
1 warning found:
The MAINTAINER instruction is deprecated...
More info: https://docs.docker.com/go/dockerfile/rule/maintainer-deprecated/

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 <sergey@homenkow.ru>
@tonistiigi tonistiigi merged commit 590adce into docker:master Dec 13, 2025
139 checks passed
@crazy-max crazy-max added this to the v0.31.0 milestone Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants