diff --git a/daemon/command/daemon.go b/daemon/command/daemon.go index 688ddf085d..46646a5d38 100644 --- a/daemon/command/daemon.go +++ b/daemon/command/daemon.go @@ -114,6 +114,11 @@ func (cli *daemonCLI) start(ctx context.Context) (err error) { debug.Enable() } + // Verify platform-specific requirements before proceeding with daemon initialization + if err := daemon.CheckSystem(); err != nil { + return fmt.Errorf("system requirements not met: %w", err) + } + if rootless.RunningWithRootlessKit() && !cli.Config.IsRootless() { return errors.New("rootless mode needs to be enabled for running with RootlessKit") } diff --git a/daemon/daemon.go b/daemon/daemon.go index 44ebd31810..ccfb9fc91a 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -807,15 +807,15 @@ func (daemon *Daemon) IsSwarmCompatible() error { return daemon.config().IsSwarmCompatible() } +// CheckSystem verifies that the system meets the platform-specific requirements +// for running the Docker daemon. +func CheckSystem() error { + return checkSystem() +} + // NewDaemon sets up everything for the daemon to be able to service // requests from the webserver. func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.Store, authzMiddleware *authorization.Middleware) (_ *Daemon, retErr error) { - // Verify platform-specific requirements. - // TODO(thaJeztah): this should be called before we try to create the daemon; perhaps together with the config validation. - if err := checkSystem(); err != nil { - return nil, err - } - registryService, err := registry.NewService(config.ServiceOptions) if err != nil { return nil, err