You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description
The
config.New()function performs unnecessary filesystem lookups when runningdockerd --version, which only needs to display version information.FIXME reference:
https://github.com/moby/moby/blob/master/daemon/command/docker.go#L19
Current behavior
When running dockerd --version, the following sequence occurs:
This happens even though
--versiononly needs to print version information and exit immediately.Code reference:
https://github.com/moby/moby/blob/master/daemon/config/config_linux.go#L158-L170
Impact
Proposed solutions
I see a few possible approaches, and I'd like to get maintainer feedback on which direction is preferred:
Option 1: Defer binary path lookup (Simple, recommended for short-term)
Delay the lookupBinPath() call until the daemon actually starts:
Pros:
Cons:
Option 2: Split Config initialization (More architectural)
Separate minimal config (for CLI purposes) from full config (for daemon):
Pros:
Better long-term architecture
Cons:
Option 3: Lazy command construction
Only construct full daemon command when not running --version:
Pros:
--version skips config.New() entirely
Cons:
Questions for maintainers
Additional context
Beta Was this translation helpful? Give feedback.
All reactions