github.com/moby/docker@v26.1.3+incompatible/daemon/config/config_windows.go (about)

     1  package config // import "github.com/docker/docker/daemon/config"
     2  
     3  import (
     4  	"context"
     5  	"os"
     6  	"path/filepath"
     7  
     8  	"github.com/containerd/log"
     9  )
    10  
    11  const (
    12  	// StockRuntimeName is used by the 'default-runtime' flag in dockerd as the
    13  	// default value. On Windows keep this empty so the value is auto-detected
    14  	// based on other options.
    15  	StockRuntimeName = ""
    16  )
    17  
    18  // BridgeConfig is meant to store all the parameters for both the bridge driver and the default bridge network. On
    19  // Windows: 1. "bridge" in this context reference the nat driver and the default nat network; 2. the nat driver has no
    20  // specific parameters, so this struct effectively just stores parameters for the default nat network.
    21  type BridgeConfig struct {
    22  	DefaultBridgeConfig
    23  }
    24  
    25  type DefaultBridgeConfig struct {
    26  	commonBridgeConfig
    27  
    28  	// MTU is not actually used on Windows, but the --mtu option has always
    29  	// been there on Windows (but ignored).
    30  	MTU int `json:"mtu,omitempty"`
    31  }
    32  
    33  // Config defines the configuration of a docker daemon.
    34  // It includes json tags to deserialize configuration from a file
    35  // using the same names that the flags in the command line uses.
    36  type Config struct {
    37  	CommonConfig
    38  
    39  	// Fields below here are platform specific. (There are none presently
    40  	// for the Windows daemon.)
    41  }
    42  
    43  // GetExecRoot returns the user configured Exec-root
    44  func (conf *Config) GetExecRoot() string {
    45  	return ""
    46  }
    47  
    48  // GetInitPath returns the configured docker-init path
    49  func (conf *Config) GetInitPath() string {
    50  	return ""
    51  }
    52  
    53  // IsSwarmCompatible defines if swarm mode can be enabled in this config
    54  func (conf *Config) IsSwarmCompatible() error {
    55  	return nil
    56  }
    57  
    58  // ValidatePlatformConfig checks if any platform-specific configuration settings are invalid.
    59  func (conf *Config) ValidatePlatformConfig() error {
    60  	if conf.MTU != 0 && conf.MTU != DefaultNetworkMtu {
    61  		log.G(context.TODO()).Warn(`WARNING: MTU for the default network is not configurable on Windows, and this option will be ignored.`)
    62  	}
    63  	return nil
    64  }
    65  
    66  // IsRootless returns conf.Rootless on Linux but false on Windows
    67  func (conf *Config) IsRootless() bool {
    68  	return false
    69  }
    70  
    71  func setPlatformDefaults(cfg *Config) error {
    72  	cfg.Root = filepath.Join(os.Getenv("programdata"), "docker")
    73  	cfg.ExecRoot = filepath.Join(os.Getenv("programdata"), "docker", "exec-root")
    74  	cfg.Pidfile = filepath.Join(cfg.Root, "docker.pid")
    75  	return nil
    76  }