2021-08-23 09:14:53 -04:00
|
|
|
//go:build linux || freebsd
|
2017-11-01 19:37:53 -04:00
|
|
|
// +build linux freebsd
|
2017-01-23 06:23:07 -05:00
|
|
|
|
2018-02-05 16:05:59 -05:00
|
|
|
package config // import "github.com/docker/docker/daemon/config"
|
2017-01-23 06:23:07 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// CommonUnixConfig defines configuration of a docker daemon that is
|
|
|
|
// common across Unix platforms.
|
|
|
|
type CommonUnixConfig struct {
|
|
|
|
Runtimes map[string]types.Runtime `json:"runtimes,omitempty"`
|
|
|
|
DefaultRuntime string `json:"default-runtime,omitempty"`
|
|
|
|
DefaultInitBinary string `json:"default-init,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type commonUnixBridgeConfig struct {
|
|
|
|
DefaultIP net.IP `json:"ip,omitempty"`
|
|
|
|
IP string `json:"bip,omitempty"`
|
|
|
|
DefaultGatewayIPv4 net.IP `json:"default-gateway,omitempty"`
|
|
|
|
DefaultGatewayIPv6 net.IP `json:"default-gateway-v6,omitempty"`
|
|
|
|
InterContainerCommunication bool `json:"icc,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetRuntime returns the runtime path and arguments for a given
|
|
|
|
// runtime name
|
|
|
|
func (conf *Config) GetRuntime(name string) *types.Runtime {
|
|
|
|
conf.Lock()
|
|
|
|
defer conf.Unlock()
|
|
|
|
if rt, ok := conf.Runtimes[name]; ok {
|
|
|
|
return &rt
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetDefaultRuntimeName returns the current default runtime
|
|
|
|
func (conf *Config) GetDefaultRuntimeName() string {
|
|
|
|
conf.Lock()
|
|
|
|
rt := conf.DefaultRuntime
|
|
|
|
conf.Unlock()
|
|
|
|
|
|
|
|
return rt
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetAllRuntimes returns a copy of the runtimes map
|
|
|
|
func (conf *Config) GetAllRuntimes() map[string]types.Runtime {
|
|
|
|
conf.Lock()
|
|
|
|
rts := conf.Runtimes
|
|
|
|
conf.Unlock()
|
|
|
|
return rts
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetExecRoot returns the user configured Exec-root
|
|
|
|
func (conf *Config) GetExecRoot() string {
|
|
|
|
return conf.ExecRoot
|
|
|
|
}
|
|
|
|
|
2017-06-06 13:36:24 -04:00
|
|
|
// GetInitPath returns the configured docker-init path
|
2017-01-23 06:23:07 -05:00
|
|
|
func (conf *Config) GetInitPath() string {
|
|
|
|
conf.Lock()
|
|
|
|
defer conf.Unlock()
|
|
|
|
if conf.InitPath != "" {
|
|
|
|
return conf.InitPath
|
|
|
|
}
|
2017-04-10 05:25:15 -04:00
|
|
|
if conf.DefaultInitBinary != "" {
|
|
|
|
return conf.DefaultInitBinary
|
|
|
|
}
|
|
|
|
return DefaultInitBinary
|
2017-01-23 06:23:07 -05:00
|
|
|
}
|
2018-07-17 15:11:38 -04:00
|
|
|
|
|
|
|
// GetResolvConf returns the appropriate resolv.conf
|
|
|
|
// Check setupResolvConf on how this is selected
|
|
|
|
func (conf *Config) GetResolvConf() string {
|
|
|
|
return conf.ResolvConf
|
|
|
|
}
|