github.com/moby/docker@v26.1.3+incompatible/cmd/dockerd/daemon_linux.go (about)

     1  package main
     2  
     3  import (
     4  	cdcgroups "github.com/containerd/cgroups/v3"
     5  	systemdDaemon "github.com/coreos/go-systemd/v22/daemon"
     6  	"github.com/docker/docker/daemon"
     7  	"github.com/docker/docker/daemon/config"
     8  	"github.com/docker/docker/pkg/sysinfo"
     9  	"github.com/pkg/errors"
    10  )
    11  
    12  // loadCLIPlatformConfig loads the platform specific CLI configuration
    13  func loadCLIPlatformConfig(conf *config.Config) error {
    14  	if conf.RemappedRoot == "" {
    15  		return nil
    16  	}
    17  
    18  	containerdNamespace, containerdPluginNamespace, err := daemon.RemapContainerdNamespaces(conf)
    19  	if err != nil {
    20  		return err
    21  	}
    22  	conf.ContainerdNamespace = containerdNamespace
    23  	conf.ContainerdPluginNamespace = containerdPluginNamespace
    24  
    25  	return nil
    26  }
    27  
    28  // preNotifyReady sends a message to the host when the API is active, but before the daemon is
    29  func preNotifyReady() {
    30  }
    31  
    32  // notifyReady sends a message to the host when the server is ready to be used
    33  func notifyReady() {
    34  	// Tell the init daemon we are accepting requests
    35  	go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady)
    36  }
    37  
    38  // notifyStopping sends a message to the host when the server is shutting down
    39  func notifyStopping() {
    40  	go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyStopping)
    41  }
    42  
    43  func validateCPURealtimeOptions(config *config.Config) error {
    44  	if config.CPURealtimePeriod == 0 && config.CPURealtimeRuntime == 0 {
    45  		return nil
    46  	}
    47  	if cdcgroups.Mode() == cdcgroups.Unified {
    48  		return errors.New("daemon-scoped cpu-rt-period and cpu-rt-runtime are not implemented for cgroup v2")
    49  	}
    50  	if !sysinfo.New().CPURealtime {
    51  		return errors.New("daemon-scoped cpu-rt-period and cpu-rt-runtime are not supported by the kernel")
    52  	}
    53  	return nil
    54  }