Skip to content

Commit b0c8ff7

Browse files
committed
daemon: Check system requirements in newDaemonCLI
Move CheckSystem() call to newDaemonCLI() for earlier validation of platform-specific requirements. Signed-off-by: hiroto.toyoda <[email protected]>
1 parent 6dac897 commit b0c8ff7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

daemon/command/daemon.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ func newDaemonCLI(opts *daemonOptions) (*daemonCLI, error) {
9393
return nil, err
9494
}
9595

96+
// Verify platform-specific requirements.
97+
// This is checked early so that `dockerd --validate` also validates system requirements.
98+
if err := daemon.CheckSystem(); err != nil {
99+
return nil, fmt.Errorf("system requirements not met: %w", err)
100+
}
101+
96102
return &daemonCLI{
97103
Config: cfg,
98104
configFile: &opts.configFile,
@@ -114,11 +120,6 @@ func (cli *daemonCLI) start(ctx context.Context) (err error) {
114120
debug.Enable()
115121
}
116122

117-
// Verify platform-specific requirements before proceeding with daemon initialization
118-
if err := daemon.CheckSystem(); err != nil {
119-
return fmt.Errorf("system requirements not met: %w", err)
120-
}
121-
122123
if rootless.RunningWithRootlessKit() && !cli.Config.IsRootless() {
123124
return errors.New("rootless mode needs to be enabled for running with RootlessKit")
124125
}

0 commit comments

Comments
 (0)