Flatten the list of `docker run` flags and group them loosely by
category (general purpose, security, networking, ...).
Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
(cherry picked from commit 5b21c8a40823edf82b3b3f22c559c524a49d25a9)
Signed-off-by: Tibor Vass <tibor@docker.com>
| ... | ... |
@@ -55,54 +55,54 @@ type ContainerOptions struct {
|
| 55 | 55 |
flStorageOpt opts.ListOpts |
| 56 | 56 |
flLabelsFile opts.ListOpts |
| 57 | 57 |
flLoggingOpts opts.ListOpts |
| 58 |
- flPrivileged *bool |
|
| 59 |
- flPidMode *string |
|
| 60 |
- flUTSMode *string |
|
| 61 |
- flUsernsMode *string |
|
| 62 |
- flPublishAll *bool |
|
| 63 |
- flStdin *bool |
|
| 64 |
- flTty *bool |
|
| 65 |
- flOomKillDisable *bool |
|
| 66 |
- flOomScoreAdj *int |
|
| 67 |
- flContainerIDFile *string |
|
| 68 |
- flEntrypoint *string |
|
| 69 |
- flHostname *string |
|
| 70 |
- flMemoryString *string |
|
| 71 |
- flMemoryReservation *string |
|
| 72 |
- flMemorySwap *string |
|
| 73 |
- flKernelMemory *string |
|
| 74 |
- flUser *string |
|
| 75 |
- flWorkingDir *string |
|
| 76 |
- flCPUShares *int64 |
|
| 77 |
- flCPUPercent *int64 |
|
| 78 |
- flCPUPeriod *int64 |
|
| 79 |
- flCPUQuota *int64 |
|
| 80 |
- flCpusetCpus *string |
|
| 81 |
- flCpusetMems *string |
|
| 82 |
- flBlkioWeight *uint16 |
|
| 83 |
- flIOMaxBandwidth *string |
|
| 84 |
- flIOMaxIOps *uint64 |
|
| 85 |
- flSwappiness *int64 |
|
| 86 |
- flNetMode *string |
|
| 87 |
- flMacAddress *string |
|
| 88 |
- flIPv4Address *string |
|
| 89 |
- flIPv6Address *string |
|
| 90 |
- flIpcMode *string |
|
| 91 |
- flPidsLimit *int64 |
|
| 92 |
- flRestartPolicy *string |
|
| 93 |
- flReadonlyRootfs *bool |
|
| 94 |
- flLoggingDriver *string |
|
| 95 |
- flCgroupParent *string |
|
| 96 |
- flVolumeDriver *string |
|
| 97 |
- flStopSignal *string |
|
| 98 |
- flIsolation *string |
|
| 99 |
- flShmSize *string |
|
| 100 |
- flNoHealthcheck *bool |
|
| 101 |
- flHealthCmd *string |
|
| 102 |
- flHealthInterval *time.Duration |
|
| 103 |
- flHealthTimeout *time.Duration |
|
| 104 |
- flHealthRetries *int |
|
| 105 |
- flRuntime *string |
|
| 58 |
+ flPrivileged bool |
|
| 59 |
+ flPidMode string |
|
| 60 |
+ flUTSMode string |
|
| 61 |
+ flUsernsMode string |
|
| 62 |
+ flPublishAll bool |
|
| 63 |
+ flStdin bool |
|
| 64 |
+ flTty bool |
|
| 65 |
+ flOomKillDisable bool |
|
| 66 |
+ flOomScoreAdj int |
|
| 67 |
+ flContainerIDFile string |
|
| 68 |
+ flEntrypoint string |
|
| 69 |
+ flHostname string |
|
| 70 |
+ flMemoryString string |
|
| 71 |
+ flMemoryReservation string |
|
| 72 |
+ flMemorySwap string |
|
| 73 |
+ flKernelMemory string |
|
| 74 |
+ flUser string |
|
| 75 |
+ flWorkingDir string |
|
| 76 |
+ flCPUShares int64 |
|
| 77 |
+ flCPUPercent int64 |
|
| 78 |
+ flCPUPeriod int64 |
|
| 79 |
+ flCPUQuota int64 |
|
| 80 |
+ flCpusetCpus string |
|
| 81 |
+ flCpusetMems string |
|
| 82 |
+ flBlkioWeight uint16 |
|
| 83 |
+ flIOMaxBandwidth string |
|
| 84 |
+ flIOMaxIOps uint64 |
|
| 85 |
+ flSwappiness int64 |
|
| 86 |
+ flNetMode string |
|
| 87 |
+ flMacAddress string |
|
| 88 |
+ flIPv4Address string |
|
| 89 |
+ flIPv6Address string |
|
| 90 |
+ flIpcMode string |
|
| 91 |
+ flPidsLimit int64 |
|
| 92 |
+ flRestartPolicy string |
|
| 93 |
+ flReadonlyRootfs bool |
|
| 94 |
+ flLoggingDriver string |
|
| 95 |
+ flCgroupParent string |
|
| 96 |
+ flVolumeDriver string |
|
| 97 |
+ flStopSignal string |
|
| 98 |
+ flIsolation string |
|
| 99 |
+ flShmSize string |
|
| 100 |
+ flNoHealthcheck bool |
|
| 101 |
+ flHealthCmd string |
|
| 102 |
+ flHealthInterval time.Duration |
|
| 103 |
+ flHealthTimeout time.Duration |
|
| 104 |
+ flHealthRetries int |
|
| 105 |
+ flRuntime string |
|
| 106 | 106 |
|
| 107 | 107 |
Image string |
| 108 | 108 |
Args []string |
| ... | ... |
@@ -111,122 +111,131 @@ type ContainerOptions struct {
|
| 111 | 111 |
// AddFlags adds all command line flags that will be used by Parse to the FlagSet |
| 112 | 112 |
func AddFlags(flags *pflag.FlagSet) *ContainerOptions {
|
| 113 | 113 |
copts := &ContainerOptions{
|
| 114 |
+ flAliases: opts.NewListOpts(nil), |
|
| 114 | 115 |
flAttach: opts.NewListOpts(ValidateAttach), |
| 115 |
- flVolumes: opts.NewListOpts(nil), |
|
| 116 |
- flTmpfs: opts.NewListOpts(nil), |
|
| 117 | 116 |
flBlkioWeightDevice: NewWeightdeviceOpt(ValidateWeightDevice), |
| 117 |
+ flCapAdd: opts.NewListOpts(nil), |
|
| 118 |
+ flCapDrop: opts.NewListOpts(nil), |
|
| 119 |
+ flDNS: opts.NewListOpts(opts.ValidateIPAddress), |
|
| 120 |
+ flDNSOptions: opts.NewListOpts(nil), |
|
| 121 |
+ flDNSSearch: opts.NewListOpts(opts.ValidateDNSSearch), |
|
| 118 | 122 |
flDeviceReadBps: NewThrottledeviceOpt(ValidateThrottleBpsDevice), |
| 119 |
- flDeviceWriteBps: NewThrottledeviceOpt(ValidateThrottleBpsDevice), |
|
| 120 |
- flLinks: opts.NewListOpts(ValidateLink), |
|
| 121 |
- flAliases: opts.NewListOpts(nil), |
|
| 122 |
- flLinkLocalIPs: opts.NewListOpts(nil), |
|
| 123 | 123 |
flDeviceReadIOps: NewThrottledeviceOpt(ValidateThrottleIOpsDevice), |
| 124 |
+ flDeviceWriteBps: NewThrottledeviceOpt(ValidateThrottleBpsDevice), |
|
| 124 | 125 |
flDeviceWriteIOps: NewThrottledeviceOpt(ValidateThrottleIOpsDevice), |
| 126 |
+ flDevices: opts.NewListOpts(ValidateDevice), |
|
| 125 | 127 |
flEnv: opts.NewListOpts(ValidateEnv), |
| 128 |
+ flEnvFile: opts.NewListOpts(nil), |
|
| 129 |
+ flExpose: opts.NewListOpts(nil), |
|
| 130 |
+ flExtraHosts: opts.NewListOpts(ValidateExtraHost), |
|
| 131 |
+ flGroupAdd: opts.NewListOpts(nil), |
|
| 126 | 132 |
flLabels: opts.NewListOpts(ValidateEnv), |
| 127 |
- flDevices: opts.NewListOpts(ValidateDevice), |
|
| 128 |
- |
|
| 129 |
- flUlimits: NewUlimitOpt(nil), |
|
| 130 |
- flSysctls: opts.NewMapOpts(nil, opts.ValidateSysctl), |
|
| 131 |
- |
|
| 132 |
- flPublish: opts.NewListOpts(nil), |
|
| 133 |
- flExpose: opts.NewListOpts(nil), |
|
| 134 |
- flDNS: opts.NewListOpts(opts.ValidateIPAddress), |
|
| 135 |
- flDNSSearch: opts.NewListOpts(opts.ValidateDNSSearch), |
|
| 136 |
- flDNSOptions: opts.NewListOpts(nil), |
|
| 137 |
- flExtraHosts: opts.NewListOpts(ValidateExtraHost), |
|
| 138 |
- flVolumesFrom: opts.NewListOpts(nil), |
|
| 139 |
- flEnvFile: opts.NewListOpts(nil), |
|
| 140 |
- flCapAdd: opts.NewListOpts(nil), |
|
| 141 |
- flCapDrop: opts.NewListOpts(nil), |
|
| 142 |
- flGroupAdd: opts.NewListOpts(nil), |
|
| 143 |
- flSecurityOpt: opts.NewListOpts(nil), |
|
| 144 |
- flStorageOpt: opts.NewListOpts(nil), |
|
| 145 |
- flLabelsFile: opts.NewListOpts(nil), |
|
| 146 |
- flLoggingOpts: opts.NewListOpts(nil), |
|
| 147 |
- |
|
| 148 |
- flPrivileged: flags.Bool("privileged", false, "Give extended privileges to this container"),
|
|
| 149 |
- flPidMode: flags.String("pid", "", "PID namespace to use"),
|
|
| 150 |
- flUTSMode: flags.String("uts", "", "UTS namespace to use"),
|
|
| 151 |
- flUsernsMode: flags.String("userns", "", "User namespace to use"),
|
|
| 152 |
- flPublishAll: flags.BoolP("publish-all", "P", false, "Publish all exposed ports to random ports"),
|
|
| 153 |
- flStdin: flags.BoolP("interactive", "i", false, "Keep STDIN open even if not attached"),
|
|
| 154 |
- flTty: flags.BoolP("tty", "t", false, "Allocate a pseudo-TTY"),
|
|
| 155 |
- flOomKillDisable: flags.Bool("oom-kill-disable", false, "Disable OOM Killer"),
|
|
| 156 |
- flOomScoreAdj: flags.Int("oom-score-adj", 0, "Tune host's OOM preferences (-1000 to 1000)"),
|
|
| 157 |
- flContainerIDFile: flags.String("cidfile", "", "Write the container ID to the file"),
|
|
| 158 |
- flEntrypoint: flags.String("entrypoint", "", "Overwrite the default ENTRYPOINT of the image"),
|
|
| 159 |
- flHostname: flags.StringP("hostname", "h", "", "Container host name"),
|
|
| 160 |
- flMemoryString: flags.StringP("memory", "m", "", "Memory limit"),
|
|
| 161 |
- flMemoryReservation: flags.String("memory-reservation", "", "Memory soft limit"),
|
|
| 162 |
- flMemorySwap: flags.String("memory-swap", "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap"),
|
|
| 163 |
- flKernelMemory: flags.String("kernel-memory", "", "Kernel memory limit"),
|
|
| 164 |
- flUser: flags.StringP("user", "u", "", "Username or UID (format: <name|uid>[:<group|gid>])"),
|
|
| 165 |
- flWorkingDir: flags.StringP("workdir", "w", "", "Working directory inside the container"),
|
|
| 166 |
- flCPUShares: flags.Int64P("cpu-shares", "c", 0, "CPU shares (relative weight)"),
|
|
| 167 |
- flCPUPercent: flags.Int64("cpu-percent", 0, "CPU percent (Windows only)"),
|
|
| 168 |
- flCPUPeriod: flags.Int64("cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period"),
|
|
| 169 |
- flCPUQuota: flags.Int64("cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota"),
|
|
| 170 |
- flCpusetCpus: flags.String("cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)"),
|
|
| 171 |
- flCpusetMems: flags.String("cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)"),
|
|
| 172 |
- flBlkioWeight: flags.Uint16("blkio-weight", 0, "Block IO (relative weight), between 10 and 1000"),
|
|
| 173 |
- flIOMaxBandwidth: flags.String("io-maxbandwidth", "", "Maximum IO bandwidth limit for the system drive (Windows only)"),
|
|
| 174 |
- flIOMaxIOps: flags.Uint64("io-maxiops", 0, "Maximum IOps limit for the system drive (Windows only)"),
|
|
| 175 |
- flSwappiness: flags.Int64("memory-swappiness", -1, "Tune container memory swappiness (0 to 100)"),
|
|
| 176 |
- flNetMode: flags.String("net", "default", "Connect a container to a network"),
|
|
| 177 |
- flMacAddress: flags.String("mac-address", "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)"),
|
|
| 178 |
- flIPv4Address: flags.String("ip", "", "Container IPv4 address (e.g. 172.30.100.104)"),
|
|
| 179 |
- flIPv6Address: flags.String("ip6", "", "Container IPv6 address (e.g. 2001:db8::33)"),
|
|
| 180 |
- flIpcMode: flags.String("ipc", "", "IPC namespace to use"),
|
|
| 181 |
- flPidsLimit: flags.Int64("pids-limit", 0, "Tune container pids limit (set -1 for unlimited)"),
|
|
| 182 |
- flRestartPolicy: flags.String("restart", "no", "Restart policy to apply when a container exits"),
|
|
| 183 |
- flReadonlyRootfs: flags.Bool("read-only", false, "Mount the container's root filesystem as read only"),
|
|
| 184 |
- flLoggingDriver: flags.String("log-driver", "", "Logging driver for container"),
|
|
| 185 |
- flCgroupParent: flags.String("cgroup-parent", "", "Optional parent cgroup for the container"),
|
|
| 186 |
- flVolumeDriver: flags.String("volume-driver", "", "Optional volume driver for the container"),
|
|
| 187 |
- flStopSignal: flags.String("stop-signal", signal.DefaultStopSignal, fmt.Sprintf("Signal to stop a container, %v by default", signal.DefaultStopSignal)),
|
|
| 188 |
- flIsolation: flags.String("isolation", "", "Container isolation technology"),
|
|
| 189 |
- flShmSize: flags.String("shm-size", "", "Size of /dev/shm, default value is 64MB"),
|
|
| 190 |
- flNoHealthcheck: flags.Bool("no-healthcheck", false, "Disable any container-specified HEALTHCHECK"),
|
|
| 191 |
- flHealthCmd: flags.String("health-cmd", "", "Command to run to check health"),
|
|
| 192 |
- flHealthInterval: flags.Duration("health-interval", 0, "Time between running the check"),
|
|
| 193 |
- flHealthTimeout: flags.Duration("health-timeout", 0, "Maximum time to allow one check to run"),
|
|
| 194 |
- flHealthRetries: flags.Int("health-retries", 0, "Consecutive failures needed to report unhealthy"),
|
|
| 195 |
- flRuntime: flags.String("runtime", "", "Runtime to use for this container"),
|
|
| 133 |
+ flLabelsFile: opts.NewListOpts(nil), |
|
| 134 |
+ flLinkLocalIPs: opts.NewListOpts(nil), |
|
| 135 |
+ flLinks: opts.NewListOpts(ValidateLink), |
|
| 136 |
+ flLoggingOpts: opts.NewListOpts(nil), |
|
| 137 |
+ flPublish: opts.NewListOpts(nil), |
|
| 138 |
+ flSecurityOpt: opts.NewListOpts(nil), |
|
| 139 |
+ flStorageOpt: opts.NewListOpts(nil), |
|
| 140 |
+ flSysctls: opts.NewMapOpts(nil, opts.ValidateSysctl), |
|
| 141 |
+ flTmpfs: opts.NewListOpts(nil), |
|
| 142 |
+ flUlimits: NewUlimitOpt(nil), |
|
| 143 |
+ flVolumes: opts.NewListOpts(nil), |
|
| 144 |
+ flVolumesFrom: opts.NewListOpts(nil), |
|
| 196 | 145 |
} |
| 197 | 146 |
|
| 147 |
+ // General purpose flags |
|
| 198 | 148 |
flags.VarP(&copts.flAttach, "attach", "a", "Attach to STDIN, STDOUT or STDERR") |
| 199 |
- flags.Var(&copts.flBlkioWeightDevice, "blkio-weight-device", "Block IO weight (relative device weight)") |
|
| 200 |
- flags.Var(&copts.flDeviceReadBps, "device-read-bps", "Limit read rate (bytes per second) from a device") |
|
| 201 |
- flags.Var(&copts.flDeviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) to a device") |
|
| 202 |
- flags.Var(&copts.flDeviceReadIOps, "device-read-iops", "Limit read rate (IO per second) from a device") |
|
| 203 |
- flags.Var(&copts.flDeviceWriteIOps, "device-write-iops", "Limit write rate (IO per second) to a device") |
|
| 204 |
- flags.VarP(&copts.flVolumes, "volume", "v", "Bind mount a volume") |
|
| 205 |
- flags.Var(&copts.flTmpfs, "tmpfs", "Mount a tmpfs directory") |
|
| 206 |
- flags.Var(&copts.flLinks, "link", "Add link to another container") |
|
| 207 |
- flags.Var(&copts.flAliases, "net-alias", "Add network-scoped alias for the container") |
|
| 208 |
- flags.Var(&copts.flLinkLocalIPs, "link-local-ip", "Container IPv4/IPv6 link-local addresses") |
|
| 209 | 149 |
flags.Var(&copts.flDevices, "device", "Add a host device to the container") |
| 210 |
- flags.VarP(&copts.flLabels, "label", "l", "Set meta data on a container") |
|
| 211 |
- flags.Var(&copts.flLabelsFile, "label-file", "Read in a line delimited file of labels") |
|
| 212 | 150 |
flags.VarP(&copts.flEnv, "env", "e", "Set environment variables") |
| 213 | 151 |
flags.Var(&copts.flEnvFile, "env-file", "Read in a file of environment variables") |
| 214 |
- flags.VarP(&copts.flPublish, "publish", "p", "Publish a container's port(s) to the host") |
|
| 215 |
- flags.Var(&copts.flExpose, "expose", "Expose a port or a range of ports") |
|
| 216 |
- flags.Var(&copts.flDNS, "dns", "Set custom DNS servers") |
|
| 217 |
- flags.Var(&copts.flDNSSearch, "dns-search", "Set custom DNS search domains") |
|
| 218 |
- flags.Var(&copts.flDNSOptions, "dns-opt", "Set DNS options") |
|
| 219 |
- flags.Var(&copts.flExtraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)") |
|
| 220 |
- flags.Var(&copts.flVolumesFrom, "volumes-from", "Mount volumes from the specified container(s)") |
|
| 152 |
+ flags.StringVar(&copts.flEntrypoint, "entrypoint", "", "Overwrite the default ENTRYPOINT of the image") |
|
| 153 |
+ flags.Var(&copts.flGroupAdd, "group-add", "Add additional groups to join") |
|
| 154 |
+ flags.StringVarP(&copts.flHostname, "hostname", "h", "", "Container host name") |
|
| 155 |
+ flags.BoolVarP(&copts.flStdin, "interactive", "i", false, "Keep STDIN open even if not attached") |
|
| 156 |
+ flags.VarP(&copts.flLabels, "label", "l", "Set meta data on a container") |
|
| 157 |
+ flags.Var(&copts.flLabelsFile, "label-file", "Read in a line delimited file of labels") |
|
| 158 |
+ flags.BoolVar(&copts.flReadonlyRootfs, "read-only", false, "Mount the container's root filesystem as read only") |
|
| 159 |
+ flags.StringVar(&copts.flRestartPolicy, "restart", "no", "Restart policy to apply when a container exits") |
|
| 160 |
+ flags.StringVar(&copts.flStopSignal, "stop-signal", signal.DefaultStopSignal, fmt.Sprintf("Signal to stop a container, %v by default", signal.DefaultStopSignal))
|
|
| 161 |
+ flags.Var(copts.flSysctls, "sysctl", "Sysctl options") |
|
| 162 |
+ flags.BoolVarP(&copts.flTty, "tty", "t", false, "Allocate a pseudo-TTY") |
|
| 163 |
+ flags.Var(copts.flUlimits, "ulimit", "Ulimit options") |
|
| 164 |
+ flags.StringVarP(&copts.flUser, "user", "u", "", "Username or UID (format: <name|uid>[:<group|gid>])") |
|
| 165 |
+ flags.StringVarP(&copts.flWorkingDir, "workdir", "w", "", "Working directory inside the container") |
|
| 166 |
+ |
|
| 167 |
+ // Security |
|
| 221 | 168 |
flags.Var(&copts.flCapAdd, "cap-add", "Add Linux capabilities") |
| 222 | 169 |
flags.Var(&copts.flCapDrop, "cap-drop", "Drop Linux capabilities") |
| 223 |
- flags.Var(&copts.flGroupAdd, "group-add", "Add additional groups to join") |
|
| 170 |
+ flags.BoolVar(&copts.flPrivileged, "privileged", false, "Give extended privileges to this container") |
|
| 224 | 171 |
flags.Var(&copts.flSecurityOpt, "security-opt", "Security Options") |
| 225 |
- flags.Var(&copts.flStorageOpt, "storage-opt", "Set storage driver options per container") |
|
| 226 |
- flags.Var(copts.flUlimits, "ulimit", "Ulimit options") |
|
| 227 |
- flags.Var(copts.flSysctls, "sysctl", "Sysctl options") |
|
| 172 |
+ flags.StringVar(&copts.flUsernsMode, "userns", "", "User namespace to use") |
|
| 173 |
+ |
|
| 174 |
+ // Network and port publishing flag |
|
| 175 |
+ flags.Var(&copts.flExtraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)") |
|
| 176 |
+ flags.Var(&copts.flDNS, "dns", "Set custom DNS servers") |
|
| 177 |
+ flags.Var(&copts.flDNSOptions, "dns-opt", "Set DNS options") |
|
| 178 |
+ flags.Var(&copts.flDNSSearch, "dns-search", "Set custom DNS search domains") |
|
| 179 |
+ flags.Var(&copts.flExpose, "expose", "Expose a port or a range of ports") |
|
| 180 |
+ flags.StringVar(&copts.flIPv4Address, "ip", "", "Container IPv4 address (e.g. 172.30.100.104)") |
|
| 181 |
+ flags.StringVar(&copts.flIPv6Address, "ip6", "", "Container IPv6 address (e.g. 2001:db8::33)") |
|
| 182 |
+ flags.Var(&copts.flLinks, "link", "Add link to another container") |
|
| 183 |
+ flags.Var(&copts.flLinkLocalIPs, "link-local-ip", "Container IPv4/IPv6 link-local addresses") |
|
| 184 |
+ flags.StringVar(&copts.flMacAddress, "mac-address", "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)") |
|
| 185 |
+ flags.StringVar(&copts.flNetMode, "net", "default", "Connect a container to a network") |
|
| 186 |
+ flags.Var(&copts.flAliases, "net-alias", "Add network-scoped alias for the container") |
|
| 187 |
+ flags.VarP(&copts.flPublish, "publish", "p", "Publish a container's port(s) to the host") |
|
| 188 |
+ flags.BoolVarP(&copts.flPublishAll, "publish-all", "P", false, "Publish all exposed ports to random ports") |
|
| 189 |
+ |
|
| 190 |
+ // Logging and storage |
|
| 191 |
+ flags.StringVar(&copts.flLoggingDriver, "log-driver", "", "Logging driver for container") |
|
| 192 |
+ flags.StringVar(&copts.flVolumeDriver, "volume-driver", "", "Optional volume driver for the container") |
|
| 228 | 193 |
flags.Var(&copts.flLoggingOpts, "log-opt", "Log driver options") |
| 194 |
+ flags.Var(&copts.flStorageOpt, "storage-opt", "Set storage driver options per container") |
|
| 195 |
+ flags.Var(&copts.flTmpfs, "tmpfs", "Mount a tmpfs directory") |
|
| 196 |
+ flags.Var(&copts.flVolumesFrom, "volumes-from", "Mount volumes from the specified container(s)") |
|
| 197 |
+ flags.VarP(&copts.flVolumes, "volume", "v", "Bind mount a volume") |
|
| 229 | 198 |
|
| 199 |
+ // Health-checking |
|
| 200 |
+ flags.StringVar(&copts.flHealthCmd, "health-cmd", "", "Command to run to check health") |
|
| 201 |
+ flags.DurationVar(&copts.flHealthInterval, "health-interval", 0, "Time between running the check") |
|
| 202 |
+ flags.IntVar(&copts.flHealthRetries, "health-retries", 0, "Consecutive failures needed to report unhealthy") |
|
| 203 |
+ flags.DurationVar(&copts.flHealthTimeout, "health-timeout", 0, "Maximum time to allow one check to run") |
|
| 204 |
+ flags.BoolVar(&copts.flNoHealthcheck, "no-healthcheck", false, "Disable any container-specified HEALTHCHECK") |
|
| 205 |
+ |
|
| 206 |
+ // Resource management |
|
| 207 |
+ flags.Uint16Var(&copts.flBlkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000") |
|
| 208 |
+ flags.Var(&copts.flBlkioWeightDevice, "blkio-weight-device", "Block IO weight (relative device weight)") |
|
| 209 |
+ flags.StringVar(&copts.flContainerIDFile, "cidfile", "", "Write the container ID to the file") |
|
| 210 |
+ flags.StringVar(&copts.flCpusetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)") |
|
| 211 |
+ flags.StringVar(&copts.flCpusetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)") |
|
| 212 |
+ flags.Int64Var(&copts.flCPUPercent, "cpu-percent", 0, "CPU percent (Windows only)") |
|
| 213 |
+ flags.Int64Var(&copts.flCPUPeriod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period") |
|
| 214 |
+ flags.Int64Var(&copts.flCPUQuota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota") |
|
| 215 |
+ flags.Int64VarP(&copts.flCPUShares, "cpu-shares", "c", 0, "CPU shares (relative weight)") |
|
| 216 |
+ flags.Var(&copts.flDeviceReadBps, "device-read-bps", "Limit read rate (bytes per second) from a device") |
|
| 217 |
+ flags.Var(&copts.flDeviceReadIOps, "device-read-iops", "Limit read rate (IO per second) from a device") |
|
| 218 |
+ flags.Var(&copts.flDeviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) to a device") |
|
| 219 |
+ flags.Var(&copts.flDeviceWriteIOps, "device-write-iops", "Limit write rate (IO per second) to a device") |
|
| 220 |
+ flags.StringVar(&copts.flIOMaxBandwidth, "io-maxbandwidth", "", "Maximum IO bandwidth limit for the system drive (Windows only)") |
|
| 221 |
+ flags.Uint64Var(&copts.flIOMaxIOps, "io-maxiops", 0, "Maximum IOps limit for the system drive (Windows only)") |
|
| 222 |
+ flags.StringVar(&copts.flKernelMemory, "kernel-memory", "", "Kernel memory limit") |
|
| 223 |
+ flags.StringVarP(&copts.flMemoryString, "memory", "m", "", "Memory limit") |
|
| 224 |
+ flags.StringVar(&copts.flMemoryReservation, "memory-reservation", "", "Memory soft limit") |
|
| 225 |
+ flags.StringVar(&copts.flMemorySwap, "memory-swap", "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") |
|
| 226 |
+ flags.Int64Var(&copts.flSwappiness, "memory-swappiness", -1, "Tune container memory swappiness (0 to 100)") |
|
| 227 |
+ flags.BoolVar(&copts.flOomKillDisable, "oom-kill-disable", false, "Disable OOM Killer") |
|
| 228 |
+ flags.IntVar(&copts.flOomScoreAdj, "oom-score-adj", 0, "Tune host's OOM preferences (-1000 to 1000)") |
|
| 229 |
+ flags.Int64Var(&copts.flPidsLimit, "pids-limit", 0, "Tune container pids limit (set -1 for unlimited)") |
|
| 230 |
+ |
|
| 231 |
+ // Low-level execution (cgroups, namespaces, ...) |
|
| 232 |
+ flags.StringVar(&copts.flCgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container") |
|
| 233 |
+ flags.StringVar(&copts.flIpcMode, "ipc", "", "IPC namespace to use") |
|
| 234 |
+ flags.StringVar(&copts.flIsolation, "isolation", "", "Container isolation technology") |
|
| 235 |
+ flags.StringVar(&copts.flPidMode, "pid", "", "PID namespace to use") |
|
| 236 |
+ flags.StringVar(&copts.flShmSize, "shm-size", "", "Size of /dev/shm, default value is 64MB") |
|
| 237 |
+ flags.StringVar(&copts.flUTSMode, "uts", "", "UTS namespace to use") |
|
| 238 |
+ flags.StringVar(&copts.flRuntime, "runtime", "", "Runtime to use for this container") |
|
| 230 | 239 |
return copts |
| 231 | 240 |
} |
| 232 | 241 |
|
| ... | ... |
@@ -241,12 +250,12 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 241 | 241 |
) |
| 242 | 242 |
|
| 243 | 243 |
// Validate the input mac address |
| 244 |
- if *copts.flMacAddress != "" {
|
|
| 245 |
- if _, err := ValidateMACAddress(*copts.flMacAddress); err != nil {
|
|
| 246 |
- return nil, nil, nil, fmt.Errorf("%s is not a valid mac address", *copts.flMacAddress)
|
|
| 244 |
+ if copts.flMacAddress != "" {
|
|
| 245 |
+ if _, err := ValidateMACAddress(copts.flMacAddress); err != nil {
|
|
| 246 |
+ return nil, nil, nil, fmt.Errorf("%s is not a valid mac address", copts.flMacAddress)
|
|
| 247 | 247 |
} |
| 248 | 248 |
} |
| 249 |
- if *copts.flStdin {
|
|
| 249 |
+ if copts.flStdin {
|
|
| 250 | 250 |
attachStdin = true |
| 251 | 251 |
} |
| 252 | 252 |
// If -a is not set, attach to stdout and stderr |
| ... | ... |
@@ -258,27 +267,27 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 258 | 258 |
var err error |
| 259 | 259 |
|
| 260 | 260 |
var flMemory int64 |
| 261 |
- if *copts.flMemoryString != "" {
|
|
| 262 |
- flMemory, err = units.RAMInBytes(*copts.flMemoryString) |
|
| 261 |
+ if copts.flMemoryString != "" {
|
|
| 262 |
+ flMemory, err = units.RAMInBytes(copts.flMemoryString) |
|
| 263 | 263 |
if err != nil {
|
| 264 | 264 |
return nil, nil, nil, err |
| 265 | 265 |
} |
| 266 | 266 |
} |
| 267 | 267 |
|
| 268 | 268 |
var MemoryReservation int64 |
| 269 |
- if *copts.flMemoryReservation != "" {
|
|
| 270 |
- MemoryReservation, err = units.RAMInBytes(*copts.flMemoryReservation) |
|
| 269 |
+ if copts.flMemoryReservation != "" {
|
|
| 270 |
+ MemoryReservation, err = units.RAMInBytes(copts.flMemoryReservation) |
|
| 271 | 271 |
if err != nil {
|
| 272 | 272 |
return nil, nil, nil, err |
| 273 | 273 |
} |
| 274 | 274 |
} |
| 275 | 275 |
|
| 276 | 276 |
var memorySwap int64 |
| 277 |
- if *copts.flMemorySwap != "" {
|
|
| 278 |
- if *copts.flMemorySwap == "-1" {
|
|
| 277 |
+ if copts.flMemorySwap != "" {
|
|
| 278 |
+ if copts.flMemorySwap == "-1" {
|
|
| 279 | 279 |
memorySwap = -1 |
| 280 | 280 |
} else {
|
| 281 |
- memorySwap, err = units.RAMInBytes(*copts.flMemorySwap) |
|
| 281 |
+ memorySwap, err = units.RAMInBytes(copts.flMemorySwap) |
|
| 282 | 282 |
if err != nil {
|
| 283 | 283 |
return nil, nil, nil, err |
| 284 | 284 |
} |
| ... | ... |
@@ -286,21 +295,21 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 286 | 286 |
} |
| 287 | 287 |
|
| 288 | 288 |
var KernelMemory int64 |
| 289 |
- if *copts.flKernelMemory != "" {
|
|
| 290 |
- KernelMemory, err = units.RAMInBytes(*copts.flKernelMemory) |
|
| 289 |
+ if copts.flKernelMemory != "" {
|
|
| 290 |
+ KernelMemory, err = units.RAMInBytes(copts.flKernelMemory) |
|
| 291 | 291 |
if err != nil {
|
| 292 | 292 |
return nil, nil, nil, err |
| 293 | 293 |
} |
| 294 | 294 |
} |
| 295 | 295 |
|
| 296 |
- swappiness := *copts.flSwappiness |
|
| 296 |
+ swappiness := copts.flSwappiness |
|
| 297 | 297 |
if swappiness != -1 && (swappiness < 0 || swappiness > 100) {
|
| 298 | 298 |
return nil, nil, nil, fmt.Errorf("invalid value: %d. Valid memory swappiness range is 0-100", swappiness)
|
| 299 | 299 |
} |
| 300 | 300 |
|
| 301 | 301 |
var shmSize int64 |
| 302 |
- if *copts.flShmSize != "" {
|
|
| 303 |
- shmSize, err = units.RAMInBytes(*copts.flShmSize) |
|
| 302 |
+ if copts.flShmSize != "" {
|
|
| 303 |
+ shmSize, err = units.RAMInBytes(copts.flShmSize) |
|
| 304 | 304 |
if err != nil {
|
| 305 | 305 |
return nil, nil, nil, err |
| 306 | 306 |
} |
| ... | ... |
@@ -308,13 +317,13 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 308 | 308 |
|
| 309 | 309 |
// TODO FIXME units.RAMInBytes should have a uint64 version |
| 310 | 310 |
var maxIOBandwidth int64 |
| 311 |
- if *copts.flIOMaxBandwidth != "" {
|
|
| 312 |
- maxIOBandwidth, err = units.RAMInBytes(*copts.flIOMaxBandwidth) |
|
| 311 |
+ if copts.flIOMaxBandwidth != "" {
|
|
| 312 |
+ maxIOBandwidth, err = units.RAMInBytes(copts.flIOMaxBandwidth) |
|
| 313 | 313 |
if err != nil {
|
| 314 | 314 |
return nil, nil, nil, err |
| 315 | 315 |
} |
| 316 | 316 |
if maxIOBandwidth < 0 {
|
| 317 |
- return nil, nil, nil, fmt.Errorf("invalid value: %s. Maximum IO Bandwidth must be positive", *copts.flIOMaxBandwidth)
|
|
| 317 |
+ return nil, nil, nil, fmt.Errorf("invalid value: %s. Maximum IO Bandwidth must be positive", copts.flIOMaxBandwidth)
|
|
| 318 | 318 |
} |
| 319 | 319 |
} |
| 320 | 320 |
|
| ... | ... |
@@ -349,8 +358,8 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 349 | 349 |
if len(copts.Args) > 0 {
|
| 350 | 350 |
runCmd = strslice.StrSlice(copts.Args) |
| 351 | 351 |
} |
| 352 |
- if *copts.flEntrypoint != "" {
|
|
| 353 |
- entrypoint = strslice.StrSlice{*copts.flEntrypoint}
|
|
| 352 |
+ if copts.flEntrypoint != "" {
|
|
| 353 |
+ entrypoint = strslice.StrSlice{copts.flEntrypoint}
|
|
| 354 | 354 |
} |
| 355 | 355 |
|
| 356 | 356 |
ports, portBindings, err := nat.ParsePortSpecs(copts.flPublish.GetAll()) |
| ... | ... |
@@ -404,32 +413,32 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 404 | 404 |
return nil, nil, nil, err |
| 405 | 405 |
} |
| 406 | 406 |
|
| 407 |
- ipcMode := container.IpcMode(*copts.flIpcMode) |
|
| 407 |
+ ipcMode := container.IpcMode(copts.flIpcMode) |
|
| 408 | 408 |
if !ipcMode.Valid() {
|
| 409 | 409 |
return nil, nil, nil, fmt.Errorf("--ipc: invalid IPC mode")
|
| 410 | 410 |
} |
| 411 | 411 |
|
| 412 |
- pidMode := container.PidMode(*copts.flPidMode) |
|
| 412 |
+ pidMode := container.PidMode(copts.flPidMode) |
|
| 413 | 413 |
if !pidMode.Valid() {
|
| 414 | 414 |
return nil, nil, nil, fmt.Errorf("--pid: invalid PID mode")
|
| 415 | 415 |
} |
| 416 | 416 |
|
| 417 |
- utsMode := container.UTSMode(*copts.flUTSMode) |
|
| 417 |
+ utsMode := container.UTSMode(copts.flUTSMode) |
|
| 418 | 418 |
if !utsMode.Valid() {
|
| 419 | 419 |
return nil, nil, nil, fmt.Errorf("--uts: invalid UTS mode")
|
| 420 | 420 |
} |
| 421 | 421 |
|
| 422 |
- usernsMode := container.UsernsMode(*copts.flUsernsMode) |
|
| 422 |
+ usernsMode := container.UsernsMode(copts.flUsernsMode) |
|
| 423 | 423 |
if !usernsMode.Valid() {
|
| 424 | 424 |
return nil, nil, nil, fmt.Errorf("--userns: invalid USER mode")
|
| 425 | 425 |
} |
| 426 | 426 |
|
| 427 |
- restartPolicy, err := ParseRestartPolicy(*copts.flRestartPolicy) |
|
| 427 |
+ restartPolicy, err := ParseRestartPolicy(copts.flRestartPolicy) |
|
| 428 | 428 |
if err != nil {
|
| 429 | 429 |
return nil, nil, nil, err |
| 430 | 430 |
} |
| 431 | 431 |
|
| 432 |
- loggingOpts, err := parseLoggingOpts(*copts.flLoggingDriver, copts.flLoggingOpts.GetAll()) |
|
| 432 |
+ loggingOpts, err := parseLoggingOpts(copts.flLoggingDriver, copts.flLoggingOpts.GetAll()) |
|
| 433 | 433 |
if err != nil {
|
| 434 | 434 |
return nil, nil, nil, err |
| 435 | 435 |
} |
| ... | ... |
@@ -446,11 +455,11 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 446 | 446 |
|
| 447 | 447 |
// Healthcheck |
| 448 | 448 |
var healthConfig *container.HealthConfig |
| 449 |
- haveHealthSettings := *copts.flHealthCmd != "" || |
|
| 450 |
- *copts.flHealthInterval != 0 || |
|
| 451 |
- *copts.flHealthTimeout != 0 || |
|
| 452 |
- *copts.flHealthRetries != 0 |
|
| 453 |
- if *copts.flNoHealthcheck {
|
|
| 449 |
+ haveHealthSettings := copts.flHealthCmd != "" || |
|
| 450 |
+ copts.flHealthInterval != 0 || |
|
| 451 |
+ copts.flHealthTimeout != 0 || |
|
| 452 |
+ copts.flHealthRetries != 0 |
|
| 453 |
+ if copts.flNoHealthcheck {
|
|
| 454 | 454 |
if haveHealthSettings {
|
| 455 | 455 |
return nil, nil, nil, fmt.Errorf("--no-healthcheck conflicts with --health-* options")
|
| 456 | 456 |
} |
| ... | ... |
@@ -458,62 +467,62 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 458 | 458 |
healthConfig = &container.HealthConfig{Test: test}
|
| 459 | 459 |
} else if haveHealthSettings {
|
| 460 | 460 |
var probe strslice.StrSlice |
| 461 |
- if *copts.flHealthCmd != "" {
|
|
| 462 |
- args := []string{"CMD-SHELL", *copts.flHealthCmd}
|
|
| 461 |
+ if copts.flHealthCmd != "" {
|
|
| 462 |
+ args := []string{"CMD-SHELL", copts.flHealthCmd}
|
|
| 463 | 463 |
probe = strslice.StrSlice(args) |
| 464 | 464 |
} |
| 465 |
- if *copts.flHealthInterval < 0 {
|
|
| 465 |
+ if copts.flHealthInterval < 0 {
|
|
| 466 | 466 |
return nil, nil, nil, fmt.Errorf("--health-interval cannot be negative")
|
| 467 | 467 |
} |
| 468 |
- if *copts.flHealthTimeout < 0 {
|
|
| 468 |
+ if copts.flHealthTimeout < 0 {
|
|
| 469 | 469 |
return nil, nil, nil, fmt.Errorf("--health-timeout cannot be negative")
|
| 470 | 470 |
} |
| 471 | 471 |
|
| 472 | 472 |
healthConfig = &container.HealthConfig{
|
| 473 | 473 |
Test: probe, |
| 474 |
- Interval: *copts.flHealthInterval, |
|
| 475 |
- Timeout: *copts.flHealthTimeout, |
|
| 476 |
- Retries: *copts.flHealthRetries, |
|
| 474 |
+ Interval: copts.flHealthInterval, |
|
| 475 |
+ Timeout: copts.flHealthTimeout, |
|
| 476 |
+ Retries: copts.flHealthRetries, |
|
| 477 | 477 |
} |
| 478 | 478 |
} |
| 479 | 479 |
|
| 480 | 480 |
resources := container.Resources{
|
| 481 |
- CgroupParent: *copts.flCgroupParent, |
|
| 481 |
+ CgroupParent: copts.flCgroupParent, |
|
| 482 | 482 |
Memory: flMemory, |
| 483 | 483 |
MemoryReservation: MemoryReservation, |
| 484 | 484 |
MemorySwap: memorySwap, |
| 485 |
- MemorySwappiness: copts.flSwappiness, |
|
| 485 |
+ MemorySwappiness: &copts.flSwappiness, |
|
| 486 | 486 |
KernelMemory: KernelMemory, |
| 487 |
- OomKillDisable: copts.flOomKillDisable, |
|
| 488 |
- CPUPercent: *copts.flCPUPercent, |
|
| 489 |
- CPUShares: *copts.flCPUShares, |
|
| 490 |
- CPUPeriod: *copts.flCPUPeriod, |
|
| 491 |
- CpusetCpus: *copts.flCpusetCpus, |
|
| 492 |
- CpusetMems: *copts.flCpusetMems, |
|
| 493 |
- CPUQuota: *copts.flCPUQuota, |
|
| 494 |
- PidsLimit: *copts.flPidsLimit, |
|
| 495 |
- BlkioWeight: *copts.flBlkioWeight, |
|
| 487 |
+ OomKillDisable: &copts.flOomKillDisable, |
|
| 488 |
+ CPUPercent: copts.flCPUPercent, |
|
| 489 |
+ CPUShares: copts.flCPUShares, |
|
| 490 |
+ CPUPeriod: copts.flCPUPeriod, |
|
| 491 |
+ CpusetCpus: copts.flCpusetCpus, |
|
| 492 |
+ CpusetMems: copts.flCpusetMems, |
|
| 493 |
+ CPUQuota: copts.flCPUQuota, |
|
| 494 |
+ PidsLimit: copts.flPidsLimit, |
|
| 495 |
+ BlkioWeight: copts.flBlkioWeight, |
|
| 496 | 496 |
BlkioWeightDevice: copts.flBlkioWeightDevice.GetList(), |
| 497 | 497 |
BlkioDeviceReadBps: copts.flDeviceReadBps.GetList(), |
| 498 | 498 |
BlkioDeviceWriteBps: copts.flDeviceWriteBps.GetList(), |
| 499 | 499 |
BlkioDeviceReadIOps: copts.flDeviceReadIOps.GetList(), |
| 500 | 500 |
BlkioDeviceWriteIOps: copts.flDeviceWriteIOps.GetList(), |
| 501 |
- IOMaximumIOps: *copts.flIOMaxIOps, |
|
| 501 |
+ IOMaximumIOps: copts.flIOMaxIOps, |
|
| 502 | 502 |
IOMaximumBandwidth: uint64(maxIOBandwidth), |
| 503 | 503 |
Ulimits: copts.flUlimits.GetList(), |
| 504 | 504 |
Devices: deviceMappings, |
| 505 | 505 |
} |
| 506 | 506 |
|
| 507 | 507 |
config := &container.Config{
|
| 508 |
- Hostname: *copts.flHostname, |
|
| 508 |
+ Hostname: copts.flHostname, |
|
| 509 | 509 |
ExposedPorts: ports, |
| 510 |
- User: *copts.flUser, |
|
| 511 |
- Tty: *copts.flTty, |
|
| 510 |
+ User: copts.flUser, |
|
| 511 |
+ Tty: copts.flTty, |
|
| 512 | 512 |
// TODO: deprecated, it comes from -n, --networking |
| 513 | 513 |
// it's still needed internally to set the network to disabled |
| 514 | 514 |
// if e.g. bridge is none in daemon opts, and in inspect |
| 515 | 515 |
NetworkDisabled: false, |
| 516 |
- OpenStdin: *copts.flStdin, |
|
| 516 |
+ OpenStdin: copts.flStdin, |
|
| 517 | 517 |
AttachStdin: attachStdin, |
| 518 | 518 |
AttachStdout: attachStdout, |
| 519 | 519 |
AttachStderr: attachStderr, |
| ... | ... |
@@ -521,24 +530,24 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 521 | 521 |
Cmd: runCmd, |
| 522 | 522 |
Image: copts.Image, |
| 523 | 523 |
Volumes: copts.flVolumes.GetMap(), |
| 524 |
- MacAddress: *copts.flMacAddress, |
|
| 524 |
+ MacAddress: copts.flMacAddress, |
|
| 525 | 525 |
Entrypoint: entrypoint, |
| 526 |
- WorkingDir: *copts.flWorkingDir, |
|
| 526 |
+ WorkingDir: copts.flWorkingDir, |
|
| 527 | 527 |
Labels: ConvertKVStringsToMap(labels), |
| 528 | 528 |
Healthcheck: healthConfig, |
| 529 | 529 |
} |
| 530 | 530 |
if flags.Changed("stop-signal") {
|
| 531 |
- config.StopSignal = *copts.flStopSignal |
|
| 531 |
+ config.StopSignal = copts.flStopSignal |
|
| 532 | 532 |
} |
| 533 | 533 |
|
| 534 | 534 |
hostConfig := &container.HostConfig{
|
| 535 | 535 |
Binds: binds, |
| 536 |
- ContainerIDFile: *copts.flContainerIDFile, |
|
| 537 |
- OomScoreAdj: *copts.flOomScoreAdj, |
|
| 538 |
- Privileged: *copts.flPrivileged, |
|
| 536 |
+ ContainerIDFile: copts.flContainerIDFile, |
|
| 537 |
+ OomScoreAdj: copts.flOomScoreAdj, |
|
| 538 |
+ Privileged: copts.flPrivileged, |
|
| 539 | 539 |
PortBindings: portBindings, |
| 540 | 540 |
Links: copts.flLinks.GetAll(), |
| 541 |
- PublishAllPorts: *copts.flPublishAll, |
|
| 541 |
+ PublishAllPorts: copts.flPublishAll, |
|
| 542 | 542 |
// Make sure the dns fields are never nil. |
| 543 | 543 |
// New containers don't ever have those fields nil, |
| 544 | 544 |
// but pre created containers can still have those nil values. |
| ... | ... |
@@ -549,7 +558,7 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 549 | 549 |
DNSOptions: copts.flDNSOptions.GetAllOrEmpty(), |
| 550 | 550 |
ExtraHosts: copts.flExtraHosts.GetAll(), |
| 551 | 551 |
VolumesFrom: copts.flVolumesFrom.GetAll(), |
| 552 |
- NetworkMode: container.NetworkMode(*copts.flNetMode), |
|
| 552 |
+ NetworkMode: container.NetworkMode(copts.flNetMode), |
|
| 553 | 553 |
IpcMode: ipcMode, |
| 554 | 554 |
PidMode: pidMode, |
| 555 | 555 |
UTSMode: utsMode, |
| ... | ... |
@@ -560,15 +569,15 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 560 | 560 |
RestartPolicy: restartPolicy, |
| 561 | 561 |
SecurityOpt: securityOpts, |
| 562 | 562 |
StorageOpt: storageOpts, |
| 563 |
- ReadonlyRootfs: *copts.flReadonlyRootfs, |
|
| 564 |
- LogConfig: container.LogConfig{Type: *copts.flLoggingDriver, Config: loggingOpts},
|
|
| 565 |
- VolumeDriver: *copts.flVolumeDriver, |
|
| 566 |
- Isolation: container.Isolation(*copts.flIsolation), |
|
| 563 |
+ ReadonlyRootfs: copts.flReadonlyRootfs, |
|
| 564 |
+ LogConfig: container.LogConfig{Type: copts.flLoggingDriver, Config: loggingOpts},
|
|
| 565 |
+ VolumeDriver: copts.flVolumeDriver, |
|
| 566 |
+ Isolation: container.Isolation(copts.flIsolation), |
|
| 567 | 567 |
ShmSize: shmSize, |
| 568 | 568 |
Resources: resources, |
| 569 | 569 |
Tmpfs: tmpfs, |
| 570 | 570 |
Sysctls: copts.flSysctls.GetAll(), |
| 571 |
- Runtime: *copts.flRuntime, |
|
| 571 |
+ Runtime: copts.flRuntime, |
|
| 572 | 572 |
} |
| 573 | 573 |
|
| 574 | 574 |
// When allocating stdin in attached mode, close stdin at client disconnect |
| ... | ... |
@@ -580,13 +589,13 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 580 | 580 |
EndpointsConfig: make(map[string]*networktypes.EndpointSettings), |
| 581 | 581 |
} |
| 582 | 582 |
|
| 583 |
- if *copts.flIPv4Address != "" || *copts.flIPv6Address != "" || copts.flLinkLocalIPs.Len() > 0 {
|
|
| 583 |
+ if copts.flIPv4Address != "" || copts.flIPv6Address != "" || copts.flLinkLocalIPs.Len() > 0 {
|
|
| 584 | 584 |
epConfig := &networktypes.EndpointSettings{}
|
| 585 | 585 |
networkingConfig.EndpointsConfig[string(hostConfig.NetworkMode)] = epConfig |
| 586 | 586 |
|
| 587 | 587 |
epConfig.IPAMConfig = &networktypes.EndpointIPAMConfig{
|
| 588 |
- IPv4Address: *copts.flIPv4Address, |
|
| 589 |
- IPv6Address: *copts.flIPv6Address, |
|
| 588 |
+ IPv4Address: copts.flIPv4Address, |
|
| 589 |
+ IPv6Address: copts.flIPv6Address, |
|
| 590 | 590 |
} |
| 591 | 591 |
|
| 592 | 592 |
if copts.flLinkLocalIPs.Len() > 0 {
|