github.com/circular-dark/docker@v1.7.0/daemon/config.go (about) 1 package daemon 2 3 import ( 4 "github.com/docker/docker/opts" 5 flag "github.com/docker/docker/pkg/mflag" 6 "github.com/docker/docker/runconfig" 7 ) 8 9 const ( 10 defaultNetworkMtu = 1500 11 disableNetworkBridge = "none" 12 ) 13 14 // CommonConfig defines the configuration of a docker daemon which are 15 // common across platforms. 16 type CommonConfig struct { 17 AutoRestart bool 18 Context map[string][]string 19 CorsHeaders string 20 DisableNetwork bool 21 Dns []string 22 DnsSearch []string 23 EnableCors bool 24 ExecDriver string 25 ExecOptions []string 26 ExecRoot string 27 GraphDriver string 28 GraphOptions []string 29 Labels []string 30 LogConfig runconfig.LogConfig 31 Mtu int 32 Pidfile string 33 Root string 34 TrustKeyPath string 35 } 36 37 // InstallCommonFlags adds command-line options to the top-level flag parser for 38 // the current process. 39 // Subsequent calls to `flag.Parse` will populate config with values parsed 40 // from the command-line. 41 func (config *Config) InstallCommonFlags() { 42 opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options") 43 opts.ListVar(&config.ExecOptions, []string{"-exec-opt"}, "Set exec driver options") 44 flag.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, defaultPidFile, "Path to use for daemon PID file") 45 flag.StringVar(&config.Root, []string{"g", "-graph"}, defaultGraph, "Root of the Docker runtime") 46 flag.StringVar(&config.ExecRoot, []string{"-exec-root"}, "/var/run/docker", "Root of the Docker execdriver") 47 flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run") 48 flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Storage driver to use") 49 flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, defaultExec, "Exec driver to use") 50 flag.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, "Set the containers network MTU") 51 flag.BoolVar(&config.EnableCors, []string{"#api-enable-cors", "#-api-enable-cors"}, false, "Enable CORS headers in the remote API, this is deprecated by --api-cors-header") 52 flag.StringVar(&config.CorsHeaders, []string{"-api-cors-header"}, "", "Set CORS headers in the remote API") 53 // FIXME: why the inconsistency between "hosts" and "sockets"? 54 opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "DNS server to use") 55 opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "DNS search domains to use") 56 opts.LabelListVar(&config.Labels, []string{"-label"}, "Set key=value labels to the daemon") 57 flag.StringVar(&config.LogConfig.Type, []string{"-log-driver"}, "json-file", "Default driver for container logs") 58 opts.LogOptsVar(config.LogConfig.Config, []string{"-log-opt"}, "Set log driver options") 59 }