This document covers the Docker daemon's configuration management, system information aggregation, and runtime reload capabilities. The configuration system handles loading, validating, merging, and reloading daemon configuration from multiple sources (daemon.json and CLI flags). The information system collects comprehensive data about the host system, runtime environment, container device interfaces (CDI), network runtime interfaces (NRI), and daemon state for API clients and debugging.
For information about the broader daemon architecture and lifecycle, see Docker Daemon Core. For details about how these systems integrate with the API layer, see API Server and Endpoints.
The Docker daemon accepts configuration from two primary sources: configuration files (typically JSON format) and command-line flags. The system provides sophisticated merging and conflict resolution between these sources via the config.Config struct and the MergeDaemonConfigurations function.
The loading process ensures that flags take precedence over file settings while detecting explicit conflicts using findConfigurationConflicts.
Sources: daemon/config/config.go449-466 daemon/config/config.go471-568 daemon/config/config.go688-777
The daemon supports JSON configuration files with specialized Unicode handling (including Byte Order Marks) and validation implemented in daemon/config/config.go.
| Component | Code Entity | Purpose |
|---|---|---|
| Parser | getConflictFreeConfiguration | Decodes JSON and tracks which keys were explicitly set. |
| Conflict Finder | findConfigurationConflicts | Compares ValuesSet from JSON against pflag.FlagSet. |
| Migration | migratedNamedConfig | Maps legacy keys (e.g., host-gateway-ip) to new structures. |
| Validation | Validate | Performs semantic checks on the merged result. |
Sources: daemon/config/config.go477-505 daemon/config/config.go570-584 daemon/config/config.go125-131 daemon/config/config.go688-777
The daemon configuration is organized into a hierarchical structure with platform-specific and common components, defined primarily in daemon/config/config.go and extended in daemon/config/config_linux.go or daemon/config/config_windows.go.
Sources: daemon/config/config.go181-301 daemon/config/config_linux.go70-97 daemon/config/config_windows.go37-45
The configuration package uses several static maps to control validation behavior:
skipDuplicates: Options like runtimes that can exist in both flags and files without failing duplication checks daemon/config/config.go116-118flatOptions: Keys that must not be parsed as deep structures (e.g., log-opts, features) daemon/config/config.go84-93skipValidateOptions: Options like min-api-version that lack corresponding CLI flags daemon/config/config.go98-108Sources: daemon/config/config.go84-123
The daemon supports reloading specific configuration options without a process restart via Daemon.Reload(conf *config.Config) daemon/reload.go91-139 This is managed transactionally using a two-phase commit protocol implemented by reloadTxn.
Sources: daemon/reload.go33-58 daemon/reload.go91-139
| Function | Code Entity | Logic |
|---|---|---|
reloadDebug | Daemon.reloadDebug | Updates newCfg.Debug and adjusts logger levels daemon/reload.go152-162 |
reloadMaxConcurrentDownloadsAndUploads | Daemon.reloadMaxConcurrentDownloadsAndUploads | Resets defaults, updates imageService config via OnCommit daemon/reload.go164-190 |
reloadLabels | Daemon.reloadLabels | Overwrites newCfg.Labels dynamically. |
reloadRegistryConfig | Daemon.reloadRegistryConfig | Updates mirror and insecure registry parameters. |
reloadNRI | Daemon.reloadNRI | Reconfigures Node Resource Interface (NRI) integration parameters. |
Sources: daemon/reload.go115-129 daemon/reload.go152-190
The SystemInfo and SystemVersion methods defined in daemon/info.go aggregate system specifications from subsystems, image services, and host introspection utilities.
Sources: daemon/info.go44-101 daemon/info.go121-174
pkg/sysinfo)The host inspection relies heavily on pkg/sysinfo to query Linux kernel features and cgroup controllers.
| Probed Feature | Code Entity / Implementation |
|---|---|
| Cgroups v1/v2 | Detects unified mode via cgroups.Mode() pkg/sysinfo/sysinfo_linux.go91-95 |
| Memory Limits | Probes memory.max or memory.limit_in_bytes pkg/sysinfo/sysinfo_linux.go131-155 |
| CPU Scheduling | Probes cpu.cfs_quota_us and cpu.shares pkg/sysinfo/sysinfo_linux.go158-179 |
| Security Modules | Inspects /sys/kernel/security for AppArmor and Seccomp profiles pkg/sysinfo/sysinfo_linux.go105-106 |
Sources: pkg/sysinfo/sysinfo.go7-49 pkg/sysinfo/sysinfo_linux.go90-128
The daemon incorporates advanced extension mechanisms such as Container Device Interface (CDI) and Node Runtime Interface (NRI).
CDISpecDirs in config.Config and populated in system.Info through daemon.fillDiscoveredDevicesFromDrivers daemon/info.go79 daemon/info.go98daemon.nri, providing runtime hooks and configuration state exposed through daemon.nri.GetInfo() during system information aggregation daemon/info.go80Sources: daemon/info.go79-80 daemon/info.go98 daemon/config/config.go257
Platform-specific capabilities are injected into system information structs via fillPlatformInfo.
runc, containerd, and init binaries daemon/info_unix.go26-76Sources: daemon/info_unix.go26-161 daemon/info_unix.go163-183
Refresh this wiki