github.com/fabiokung/docker@v0.11.2-0.20170222101415-4534dcd49497/daemon/config/config_common_unix.go (about) 1 // +build solaris linux freebsd 2 3 package config 4 5 import ( 6 "net" 7 8 "github.com/docker/docker/api/types" 9 ) 10 11 // CommonUnixConfig defines configuration of a docker daemon that is 12 // common across Unix platforms. 13 type CommonUnixConfig struct { 14 ExecRoot string `json:"exec-root,omitempty"` 15 ContainerdAddr string `json:"containerd,omitempty"` 16 Runtimes map[string]types.Runtime `json:"runtimes,omitempty"` 17 DefaultRuntime string `json:"default-runtime,omitempty"` 18 DefaultInitBinary string `json:"default-init,omitempty"` 19 } 20 21 type commonUnixBridgeConfig struct { 22 DefaultIP net.IP `json:"ip,omitempty"` 23 IP string `json:"bip,omitempty"` 24 DefaultGatewayIPv4 net.IP `json:"default-gateway,omitempty"` 25 DefaultGatewayIPv6 net.IP `json:"default-gateway-v6,omitempty"` 26 InterContainerCommunication bool `json:"icc,omitempty"` 27 } 28 29 // GetRuntime returns the runtime path and arguments for a given 30 // runtime name 31 func (conf *Config) GetRuntime(name string) *types.Runtime { 32 conf.Lock() 33 defer conf.Unlock() 34 if rt, ok := conf.Runtimes[name]; ok { 35 return &rt 36 } 37 return nil 38 } 39 40 // GetDefaultRuntimeName returns the current default runtime 41 func (conf *Config) GetDefaultRuntimeName() string { 42 conf.Lock() 43 rt := conf.DefaultRuntime 44 conf.Unlock() 45 46 return rt 47 } 48 49 // GetAllRuntimes returns a copy of the runtimes map 50 func (conf *Config) GetAllRuntimes() map[string]types.Runtime { 51 conf.Lock() 52 rts := conf.Runtimes 53 conf.Unlock() 54 return rts 55 } 56 57 // GetExecRoot returns the user configured Exec-root 58 func (conf *Config) GetExecRoot() string { 59 return conf.ExecRoot 60 } 61 62 // GetInitPath returns the configure docker-init path 63 func (conf *Config) GetInitPath() string { 64 conf.Lock() 65 defer conf.Unlock() 66 if conf.InitPath != "" { 67 return conf.InitPath 68 } 69 return conf.DefaultInitBinary 70 }