github.com/rish1988/moby@v25.0.2+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  	// minAPIVersion represents Minimum REST API version supported
    18  	// Technically the first daemon API version released on Windows is v1.25 in
    19  	// engine version 1.13. However, some clients are explicitly using downlevel
    20  	// APIs (e.g. docker-compose v2.1 file format) and that is just too restrictive.
    21  	// Hence also allowing 1.24 on Windows.
    22  	minAPIVersion string = "1.24"
    23  )
    24  
    25  // BridgeConfig is meant to store all the parameters for both the bridge driver and the default bridge network. On
    26  // Windows: 1. "bridge" in this context reference the nat driver and the default nat network; 2. the nat driver has no
    27  // specific parameters, so this struct effectively just stores parameters for the default nat network.
    28  type BridgeConfig struct {
    29  	DefaultBridgeConfig
    30  }
    31  
    32  type DefaultBridgeConfig struct {
    33  	commonBridgeConfig
    34  
    35  	// MTU is not actually used on Windows, but the --mtu option has always
    36  	// been there on Windows (but ignored).
    37  	MTU int `json:"mtu,omitempty"`
    38  }
    39  
    40  // Config defines the configuration of a docker daemon.
    41  // It includes json tags to deserialize configuration from a file
    42  // using the same names that the flags in the command line uses.
    43  type Config struct {
    44  	CommonConfig
    45  
    46  	// Fields below here are platform specific. (There are none presently
    47  	// for the Windows daemon.)
    48  }
    49  
    50  // GetExecRoot returns the user configured Exec-root
    51  func (conf *Config) GetExecRoot() string {
    52  	return ""
    53  }
    54  
    55  // GetInitPath returns the configured docker-init path
    56  func (conf *Config) GetInitPath() string {
    57  	return ""
    58  }
    59  
    60  // IsSwarmCompatible defines if swarm mode can be enabled in this config
    61  func (conf *Config) IsSwarmCompatible() error {
    62  	return nil
    63  }
    64  
    65  // ValidatePlatformConfig checks if any platform-specific configuration settings are invalid.
    66  func (conf *Config) ValidatePlatformConfig() error {
    67  	if conf.MTU != 0 && conf.MTU != DefaultNetworkMtu {
    68  		log.G(context.TODO()).Warn(`WARNING: MTU for the default network is not configurable on Windows, and this option will be ignored.`)
    69  	}
    70  	return nil
    71  }
    72  
    73  // IsRootless returns conf.Rootless on Linux but false on Windows
    74  func (conf *Config) IsRootless() bool {
    75  	return false
    76  }
    77  
    78  func setPlatformDefaults(cfg *Config) error {
    79  	cfg.Root = filepath.Join(os.Getenv("programdata"), "docker")
    80  	cfg.ExecRoot = filepath.Join(os.Getenv("programdata"), "docker", "exec-root")
    81  	cfg.Pidfile = filepath.Join(cfg.Root, "docker.pid")
    82  	return nil
    83  }