daemon/config.go
a4befff5
 package daemon
1cbdaeba
 
 import (
353b7c8e
 	"github.com/docker/docker/opts"
 	flag "github.com/docker/docker/pkg/mflag"
47a6afb9
 	"github.com/docker/docker/runconfig"
1cbdaeba
 )
 
c712e74b
 const (
4d0a026c
 	defaultNetworkMtu    = 1500
67c254a6
 	disableNetworkBridge = "none"
c712e74b
 )
 
b3bca3af
 // CommonConfig defines the configuration of a docker daemon which are
 // common across platforms.
 type CommonConfig struct {
ead2f800
 	AutoRestart    bool
e0ec0cc1
 	Bridge         bridgeConfig // Bridge holds bridge network specific configuration.
b3bca3af
 	Context        map[string][]string
 	CorsHeaders    string
c9328c6c
 	DisableBridge  bool
b3bca3af
 	Dns            []string
 	DnsSearch      []string
 	EnableCors     bool
 	ExecDriver     string
ead2f800
 	ExecOptions    []string
8b2c6cb0
 	ExecRoot       string
b3bca3af
 	GraphDriver    string
ead2f800
 	GraphOptions   []string
b3bca3af
 	Labels         []string
 	LogConfig      runconfig.LogConfig
 	Mtu            int
 	Pidfile        string
 	Root           string
 	TrustKeyPath   string
da5a3e6d
 	DefaultNetwork string
508065a7
 	NetworkKVStore string
1cbdaeba
 }
0d1a8251
 
b3bca3af
 // InstallCommonFlags adds command-line options to the top-level flag parser for
353b7c8e
 // the current process.
 // Subsequent calls to `flag.Parse` will populate config with values parsed
 // from the command-line.
96ce3a19
 func (config *Config) InstallCommonFlags(cmd *flag.FlagSet, usageFn func(string) string) {
 	cmd.Var(opts.NewListOptsRef(&config.GraphOptions, nil), []string{"-storage-opt"}, usageFn("Set storage driver options"))
 	cmd.Var(opts.NewListOptsRef(&config.ExecOptions, nil), []string{"-exec-opt"}, usageFn("Set exec driver options"))
 	cmd.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, defaultPidFile, usageFn("Path to use for daemon PID file"))
 	cmd.StringVar(&config.Root, []string{"g", "-graph"}, defaultGraph, usageFn("Root of the Docker runtime"))
 	cmd.StringVar(&config.ExecRoot, []string{"-exec-root"}, "/var/run/docker", usageFn("Root of the Docker execdriver"))
 	cmd.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, usageFn("--restart on the daemon has been deprecated in favor of --restart policies on docker run"))
 	cmd.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", usageFn("Storage driver to use"))
 	cmd.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, defaultExec, usageFn("Exec driver to use"))
 	cmd.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, usageFn("Set the containers network MTU"))
 	cmd.BoolVar(&config.EnableCors, []string{"#api-enable-cors", "#-api-enable-cors"}, false, usageFn("Enable CORS headers in the remote API, this is deprecated by --api-cors-header"))
 	cmd.StringVar(&config.CorsHeaders, []string{"-api-cors-header"}, "", usageFn("Set CORS headers in the remote API"))
353b7c8e
 	// FIXME: why the inconsistency between "hosts" and "sockets"?
96ce3a19
 	cmd.Var(opts.NewListOptsRef(&config.Dns, opts.ValidateIPAddress), []string{"#dns", "-dns"}, usageFn("DNS server to use"))
 	cmd.Var(opts.NewListOptsRef(&config.DnsSearch, opts.ValidateDNSSearch), []string{"-dns-search"}, usageFn("DNS search domains to use"))
 	cmd.Var(opts.NewListOptsRef(&config.Labels, opts.ValidateLabel), []string{"-label"}, usageFn("Set key=value labels to the daemon"))
 	cmd.StringVar(&config.LogConfig.Type, []string{"-log-driver"}, "json-file", usageFn("Default driver for container logs"))
 	cmd.Var(opts.NewMapOpts(config.LogConfig.Config, nil), []string{"-log-opt"}, usageFn("Set log driver options"))
353b7c8e
 }