github.com/projectatomic/docker@v1.8.2/daemon/config_linux.go (about)

     1  package daemon
     2  
     3  import (
     4  	"net"
     5  
     6  	"github.com/docker/docker/opts"
     7  	flag "github.com/docker/docker/pkg/mflag"
     8  	"github.com/docker/docker/pkg/ulimit"
     9  )
    10  
    11  var (
    12  	defaultPidFile = "/var/run/docker.pid"
    13  	defaultGraph   = "/var/lib/docker"
    14  	defaultExec    = "native"
    15  )
    16  
    17  // Config defines the configuration of a docker daemon.
    18  // These are the configuration settings that you pass
    19  // to the docker daemon when you launch it with say: `docker -d -e lxc`
    20  type Config struct {
    21  	CommonConfig
    22  
    23  	// Fields below here are platform specific.
    24  
    25  	EnableSelinuxSupport bool
    26  	SocketGroup          string
    27  	Ulimits              map[string]*ulimit.Ulimit
    28  }
    29  
    30  // bridgeConfig stores all the bridge driver specific
    31  // configuration.
    32  type bridgeConfig struct {
    33  	EnableIPv6                  bool
    34  	EnableIPTables              bool
    35  	EnableIPForward             bool
    36  	EnableIPMasq                bool
    37  	EnableUserlandProxy         bool
    38  	DefaultIP                   net.IP
    39  	Iface                       string
    40  	IP                          string
    41  	FixedCIDR                   string
    42  	FixedCIDRv6                 string
    43  	DefaultGatewayIPv4          net.IP
    44  	DefaultGatewayIPv6          net.IP
    45  	InterContainerCommunication bool
    46  }
    47  
    48  // InstallFlags adds command-line options to the top-level flag parser for
    49  // the current process.
    50  // Subsequent calls to `flag.Parse` will populate config with values parsed
    51  // from the command-line.
    52  func (config *Config) InstallFlags(cmd *flag.FlagSet, usageFn func(string) string) {
    53  	// First handle install flags which are consistent cross-platform
    54  	config.InstallCommonFlags(cmd, usageFn)
    55  
    56  	// Then platform-specific install flags
    57  	cmd.BoolVar(&config.EnableSelinuxSupport, []string{"-selinux-enabled"}, false, usageFn("Enable selinux support"))
    58  	cmd.StringVar(&config.SocketGroup, []string{"G", "-group"}, "docker", usageFn("Group for the unix socket"))
    59  	config.Ulimits = make(map[string]*ulimit.Ulimit)
    60  	cmd.Var(opts.NewUlimitOpt(&config.Ulimits), []string{"-default-ulimit"}, usageFn("Set default ulimits for containers"))
    61  	cmd.BoolVar(&config.Bridge.EnableIPTables, []string{"#iptables", "-iptables"}, true, usageFn("Enable addition of iptables rules"))
    62  	cmd.BoolVar(&config.Bridge.EnableIPForward, []string{"#ip-forward", "-ip-forward"}, true, usageFn("Enable net.ipv4.ip_forward"))
    63  	cmd.BoolVar(&config.Bridge.EnableIPMasq, []string{"-ip-masq"}, true, usageFn("Enable IP masquerading"))
    64  	cmd.BoolVar(&config.Bridge.EnableIPv6, []string{"-ipv6"}, false, usageFn("Enable IPv6 networking"))
    65  	cmd.StringVar(&config.Bridge.IP, []string{"#bip", "-bip"}, "", usageFn("Specify network bridge IP"))
    66  	cmd.StringVar(&config.Bridge.Iface, []string{"b", "-bridge"}, "", usageFn("Attach containers to a network bridge"))
    67  	cmd.StringVar(&config.Bridge.FixedCIDR, []string{"-fixed-cidr"}, "", usageFn("IPv4 subnet for fixed IPs"))
    68  	cmd.StringVar(&config.Bridge.FixedCIDRv6, []string{"-fixed-cidr-v6"}, "", usageFn("IPv6 subnet for fixed IPs"))
    69  	cmd.Var(opts.NewIpOpt(&config.Bridge.DefaultGatewayIPv4, ""), []string{"-default-gateway"}, usageFn("Container default gateway IPv4 address"))
    70  	cmd.Var(opts.NewIpOpt(&config.Bridge.DefaultGatewayIPv6, ""), []string{"-default-gateway-v6"}, usageFn("Container default gateway IPv6 address"))
    71  	cmd.BoolVar(&config.Bridge.InterContainerCommunication, []string{"#icc", "-icc"}, true, usageFn("Enable inter-container communication"))
    72  	cmd.Var(opts.NewIpOpt(&config.Bridge.DefaultIP, "0.0.0.0"), []string{"#ip", "-ip"}, usageFn("Default IP when binding container ports"))
    73  	cmd.BoolVar(&config.Bridge.EnableUserlandProxy, []string{"-userland-proxy"}, true, usageFn("Use userland proxy for loopback traffic"))
    74  
    75  	config.attachExperimentalFlags(cmd, usageFn)
    76  }