github.com/skanehira/moby@v17.12.1-ce-rc2+incompatible/cmd/dockerd/config_unix.go (about)

     1  // +build linux freebsd
     2  
     3  package main
     4  
     5  import (
     6  	"github.com/docker/docker/daemon/config"
     7  	"github.com/docker/docker/opts"
     8  	units "github.com/docker/go-units"
     9  	"github.com/spf13/pflag"
    10  )
    11  
    12  // installConfigFlags adds flags to the pflag.FlagSet to configure the daemon
    13  func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
    14  	// First handle install flags which are consistent cross-platform
    15  	installCommonConfigFlags(conf, flags)
    16  
    17  	// Then install flags common to unix platforms
    18  	installUnixConfigFlags(conf, flags)
    19  
    20  	conf.Ulimits = make(map[string]*units.Ulimit)
    21  
    22  	// Set default value for `--default-shm-size`
    23  	conf.ShmSize = opts.MemBytes(config.DefaultShmSize)
    24  
    25  	// Then platform-specific install flags
    26  	flags.BoolVar(&conf.EnableSelinuxSupport, "selinux-enabled", false, "Enable selinux support")
    27  	flags.Var(opts.NewNamedUlimitOpt("default-ulimits", &conf.Ulimits), "default-ulimit", "Default ulimits for containers")
    28  	flags.BoolVar(&conf.BridgeConfig.EnableIPTables, "iptables", true, "Enable addition of iptables rules")
    29  	flags.BoolVar(&conf.BridgeConfig.EnableIPForward, "ip-forward", true, "Enable net.ipv4.ip_forward")
    30  	flags.BoolVar(&conf.BridgeConfig.EnableIPMasq, "ip-masq", true, "Enable IP masquerading")
    31  	flags.BoolVar(&conf.BridgeConfig.EnableIPv6, "ipv6", false, "Enable IPv6 networking")
    32  	flags.StringVar(&conf.BridgeConfig.FixedCIDRv6, "fixed-cidr-v6", "", "IPv6 subnet for fixed IPs")
    33  	flags.BoolVar(&conf.BridgeConfig.EnableUserlandProxy, "userland-proxy", true, "Use userland proxy for loopback traffic")
    34  	flags.StringVar(&conf.BridgeConfig.UserlandProxyPath, "userland-proxy-path", "", "Path to the userland proxy binary")
    35  	flags.StringVar(&conf.CgroupParent, "cgroup-parent", "", "Set parent cgroup for all containers")
    36  	flags.StringVar(&conf.RemappedRoot, "userns-remap", "", "User/Group setting for user namespaces")
    37  	flags.BoolVar(&conf.LiveRestoreEnabled, "live-restore", false, "Enable live restore of docker when containers are still running")
    38  	flags.IntVar(&conf.OOMScoreAdjust, "oom-score-adjust", -500, "Set the oom_score_adj for the daemon")
    39  	flags.BoolVar(&conf.Init, "init", false, "Run an init in the container to forward signals and reap processes")
    40  	flags.StringVar(&conf.InitPath, "init-path", "", "Path to the docker-init binary")
    41  	flags.Int64Var(&conf.CPURealtimePeriod, "cpu-rt-period", 0, "Limit the CPU real-time period in microseconds")
    42  	flags.Int64Var(&conf.CPURealtimeRuntime, "cpu-rt-runtime", 0, "Limit the CPU real-time runtime in microseconds")
    43  	flags.StringVar(&conf.SeccompProfile, "seccomp-profile", "", "Path to seccomp profile")
    44  	flags.Var(&conf.ShmSize, "default-shm-size", "Default shm size for containers")
    45  	flags.BoolVar(&conf.NoNewPrivileges, "no-new-privileges", false, "Set no-new-privileges by default for new containers")
    46  	flags.StringVar(&conf.IpcMode, "default-ipc-mode", config.DefaultIpcMode, `Default mode for containers ipc ("shareable" | "private")`)
    47  
    48  	attachExperimentalFlags(conf, flags)
    49  }