github.com/fabiokung/docker@v0.11.2-0.20170222101415-4534dcd49497/daemon/config/config_unix.go (about)

     1  // +build linux freebsd
     2  
     3  package config
     4  
     5  import (
     6  	"fmt"
     7  
     8  	"github.com/docker/docker/opts"
     9  	units "github.com/docker/go-units"
    10  )
    11  
    12  // Config defines the configuration of a docker daemon.
    13  // It includes json tags to deserialize configuration from a file
    14  // using the same names that the flags in the command line uses.
    15  type Config struct {
    16  	CommonConfig
    17  
    18  	// These fields are common to all unix platforms.
    19  	CommonUnixConfig
    20  
    21  	// Fields below here are platform specific.
    22  	CgroupParent         string                   `json:"cgroup-parent,omitempty"`
    23  	EnableSelinuxSupport bool                     `json:"selinux-enabled,omitempty"`
    24  	RemappedRoot         string                   `json:"userns-remap,omitempty"`
    25  	Ulimits              map[string]*units.Ulimit `json:"default-ulimits,omitempty"`
    26  	CPURealtimePeriod    int64                    `json:"cpu-rt-period,omitempty"`
    27  	CPURealtimeRuntime   int64                    `json:"cpu-rt-runtime,omitempty"`
    28  	OOMScoreAdjust       int                      `json:"oom-score-adjust,omitempty"`
    29  	Init                 bool                     `json:"init,omitempty"`
    30  	InitPath             string                   `json:"init-path,omitempty"`
    31  	SeccompProfile       string                   `json:"seccomp-profile,omitempty"`
    32  	ShmSize              opts.MemBytes            `json:"default-shm-size,omitempty"`
    33  	NoNewPrivileges      bool                     `json:"no-new-privileges,omitempty"`
    34  }
    35  
    36  // BridgeConfig stores all the bridge driver specific
    37  // configuration.
    38  type BridgeConfig struct {
    39  	commonBridgeConfig
    40  
    41  	// These fields are common to all unix platforms.
    42  	commonUnixBridgeConfig
    43  
    44  	// Fields below here are platform specific.
    45  	EnableIPv6          bool   `json:"ipv6,omitempty"`
    46  	EnableIPTables      bool   `json:"iptables,omitempty"`
    47  	EnableIPForward     bool   `json:"ip-forward,omitempty"`
    48  	EnableIPMasq        bool   `json:"ip-masq,omitempty"`
    49  	EnableUserlandProxy bool   `json:"userland-proxy,omitempty"`
    50  	UserlandProxyPath   string `json:"userland-proxy-path,omitempty"`
    51  	FixedCIDRv6         string `json:"fixed-cidr-v6,omitempty"`
    52  }
    53  
    54  // IsSwarmCompatible defines if swarm mode can be enabled in this config
    55  func (conf *Config) IsSwarmCompatible() error {
    56  	if conf.ClusterStore != "" || conf.ClusterAdvertise != "" {
    57  		return fmt.Errorf("--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode")
    58  	}
    59  	if conf.LiveRestoreEnabled {
    60  		return fmt.Errorf("--live-restore daemon configuration is incompatible with swarm mode")
    61  	}
    62  	return nil
    63  }