github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/daemon/config/config_windows.go (about)

     1  package config // import "github.com/Prakhar-Agarwal-byte/moby/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 stores all the bridge driver specific
    19  // configuration.
    20  type BridgeConfig struct {
    21  	commonBridgeConfig
    22  
    23  	// MTU is not actually used on Windows, but the --mtu option has always
    24  	// been there on Windows (but ignored).
    25  	MTU int `json:"mtu,omitempty"`
    26  }
    27  
    28  // Config defines the configuration of a docker daemon.
    29  // It includes json tags to deserialize configuration from a file
    30  // using the same names that the flags in the command line uses.
    31  type Config struct {
    32  	CommonConfig
    33  
    34  	// Fields below here are platform specific. (There are none presently
    35  	// for the Windows daemon.)
    36  }
    37  
    38  // GetExecRoot returns the user configured Exec-root
    39  func (conf *Config) GetExecRoot() string {
    40  	return ""
    41  }
    42  
    43  // GetInitPath returns the configured docker-init path
    44  func (conf *Config) GetInitPath() string {
    45  	return ""
    46  }
    47  
    48  // IsSwarmCompatible defines if swarm mode can be enabled in this config
    49  func (conf *Config) IsSwarmCompatible() error {
    50  	return nil
    51  }
    52  
    53  // ValidatePlatformConfig checks if any platform-specific configuration settings are invalid.
    54  func (conf *Config) ValidatePlatformConfig() error {
    55  	if conf.MTU != 0 && conf.MTU != DefaultNetworkMtu {
    56  		log.G(context.TODO()).Warn(`WARNING: MTU for the default network is not configurable on Windows, and this option will be ignored.`)
    57  	}
    58  	return nil
    59  }
    60  
    61  // IsRootless returns conf.Rootless on Linux but false on Windows
    62  func (conf *Config) IsRootless() bool {
    63  	return false
    64  }
    65  
    66  func setPlatformDefaults(cfg *Config) error {
    67  	cfg.Root = filepath.Join(os.Getenv("programdata"), "docker")
    68  	cfg.ExecRoot = filepath.Join(os.Getenv("programdata"), "docker", "exec-root")
    69  	cfg.Pidfile = filepath.Join(cfg.Root, "docker.pid")
    70  	return nil
    71  }