Browse code

keep network option consistent between network connect and run

Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>

yuexiao-wang authored on 2016/12/28 20:34:32
Showing 8 changed files
... ...
@@ -193,11 +193,11 @@ func addFlags(flags *pflag.FlagSet) *containerOptions {
193 193
 	flags.MarkHidden("dns-opt")
194 194
 	flags.Var(&copts.dnsSearch, "dns-search", "Set custom DNS search domains")
195 195
 	flags.Var(&copts.expose, "expose", "Expose a port or a range of ports")
196
-	flags.StringVar(&copts.ipv4Address, "ip", "", "Container IPv4 address (e.g. 172.30.100.104)")
197
-	flags.StringVar(&copts.ipv6Address, "ip6", "", "Container IPv6 address (e.g. 2001:db8::33)")
196
+	flags.StringVar(&copts.ipv4Address, "ip", "", "IPv4 address (e.g., 172.30.100.104)")
197
+	flags.StringVar(&copts.ipv6Address, "ip6", "", "IPv6 address (e.g., 2001:db8::33)")
198 198
 	flags.Var(&copts.links, "link", "Add link to another container")
199 199
 	flags.Var(&copts.linkLocalIPs, "link-local-ip", "Container IPv4/IPv6 link-local addresses")
200
-	flags.StringVar(&copts.macAddress, "mac-address", "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)")
200
+	flags.StringVar(&copts.macAddress, "mac-address", "", "Container MAC address (e.g., 92:d0:c6:0a:29:33)")
201 201
 	flags.VarP(&copts.publish, "publish", "p", "Publish a container's port(s) to the host")
202 202
 	flags.BoolVarP(&copts.publishAll, "publish-all", "P", false, "Publish all exposed ports to random ports")
203 203
 	// We allow for both "--net" and "--network", although the latter is the recommended way.
... ...
@@ -37,8 +37,8 @@ func newConnectCommand(dockerCli *command.DockerCli) *cobra.Command {
37 37
 	}
38 38
 
39 39
 	flags := cmd.Flags()
40
-	flags.StringVar(&opts.ipaddress, "ip", "", "IP Address")
41
-	flags.StringVar(&opts.ipv6address, "ip6", "", "IPv6 Address")
40
+	flags.StringVar(&opts.ipaddress, "ip", "", "IPv4 address (e.g., 172.30.100.104)")
41
+	flags.StringVar(&opts.ipv6address, "ip6", "", "IPv6 address (e.g., 2001:db8::33)")
42 42
 	flags.Var(&opts.links, "link", "Add link to another container")
43 43
 	flags.StringSliceVar(&opts.aliases, "alias", []string{}, "Add network-scoped alias for the container")
44 44
 	flags.StringSliceVar(&opts.linklocalips, "link-local-ip", []string{}, "Add a link-local address for the container")
... ...
@@ -135,7 +135,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from create' -s i -l interac
135 135
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l ipc -d 'Default is to create a private IPC namespace (POSIX SysV IPC) for the container'
136 136
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l link -d 'Add link to another container in the form of <name|id>:alias'
137 137
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -s m -l memory -d 'Memory limit (format: <number>[<unit>], where unit = b, k, m or g)'
138
-complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l mac-address -d 'Container MAC address (e.g. 92:d0:c6:0a:29:33)'
138
+complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l mac-address -d 'Container MAC address (e.g., 92:d0:c6:0a:29:33)'
139 139
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l memory-swap -d "Total memory usage (memory + swap), set '-1' to disable swap (format: <number>[<unit>], where unit = b, k, m or g)"
140 140
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l name -d 'Assign a name to the container'
141 141
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l net -d 'Set the Network mode for the container'
... ...
@@ -326,7 +326,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s i -l interactiv
326 326
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l ipc -d 'Default is to create a private IPC namespace (POSIX SysV IPC) for the container'
327 327
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l link -d 'Add link to another container in the form of <name|id>:alias'
328 328
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s m -l memory -d 'Memory limit (format: <number>[<unit>], where unit = b, k, m or g)'
329
-complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l mac-address -d 'Container MAC address (e.g. 92:d0:c6:0a:29:33)'
329
+complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l mac-address -d 'Container MAC address (e.g., 92:d0:c6:0a:29:33)'
330 330
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l memory-swap -d "Total memory usage (memory + swap), set '-1' to disable swap (format: <number>[<unit>], where unit = b, k, m or g)"
331 331
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l name -d 'Assign a name to the container'
332 332
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l net -d 'Set the Network mode for the container'
... ...
@@ -541,12 +541,12 @@ __docker_container_subcommand() {
541 541
         "($help)*--group=[Set one or more supplementary user groups for the container]:group:_groups"
542 542
         "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts"
543 543
         "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]"
544
-        "($help)--ip=[Container IPv4 address]:IPv4: "
545
-        "($help)--ip6=[Container IPv6 address]:IPv6: "
544
+        "($help)--ip=[IPv4 address]:IPv4: "
545
+        "($help)--ip6=[IPv6 address]:IPv6: "
546 546
         "($help)--ipc=[IPC namespace to use]:IPC namespace: "
547 547
         "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)"
548 548
         "($help)*--link=[Add link to another container]:link:->link"
549
-        "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: "
549
+        "($help)*--link-local-ip=[Container IPv4/IPv6 link-local addresses]:IPv4/IPv6: "
550 550
         "($help)*"{-l=,--label=}"[Container metadata]:label: "
551 551
         "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers"
552 552
         "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_complete_log_options"
... ...
@@ -1142,8 +1142,8 @@ __docker_network_subcommand() {
1142 1142
             _arguments $(__docker_arguments) \
1143 1143
                 $opts_help \
1144 1144
                 "($help)*--alias=[Add network-scoped alias for the container]:alias: " \
1145
-                "($help)--ip=[Container IPv4 address]:IPv4: " \
1146
-                "($help)--ip6=[Container IPv6 address]:IPv6: " \
1145
+                "($help)--ip=[IPv4 address]:IPv4: " \
1146
+                "($help)--ip6=[IPv6 address]:IPv6: " \
1147 1147
                 "($help)*--link=[Add a link to another container]:link:->link" \
1148 1148
                 "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: " \
1149 1149
                 "($help -)1:network:__docker_complete_networks" \
... ...
@@ -66,8 +66,8 @@ Options:
66 66
   -i, --interactive                 Keep STDIN open even if not attached
67 67
       --io-maxbandwidth string      Maximum IO bandwidth limit for the system drive (Windows only)
68 68
       --io-maxiops uint             Maximum IOps limit for the system drive (Windows only)
69
-      --ip string                   Container IPv4 address (e.g. 172.30.100.104)
70
-      --ip6 string                  Container IPv6 address (e.g. 2001:db8::33)
69
+      --ip string                   IPv4 address (e.g., 172.30.100.104)
70
+      --ip6 string                  IPv6 address (e.g., 2001:db8::33)
71 71
       --ipc string                  IPC namespace to use
72 72
       --isolation string            Container isolation technology
73 73
       --kernel-memory string        Kernel memory limit
... ...
@@ -77,7 +77,7 @@ Options:
77 77
       --link-local-ip value         Container IPv4/IPv6 link-local addresses (default [])
78 78
       --log-driver string           Logging driver for the container
79 79
       --log-opt value               Log driver options (default [])
80
-      --mac-address string          Container MAC address (e.g. 92:d0:c6:0a:29:33)
80
+      --mac-address string          Container MAC address (e.g., 92:d0:c6:0a:29:33)
81 81
   -m, --memory string               Memory limit
82 82
       --memory-reservation string   Memory soft limit
83 83
       --memory-swap string          Swap limit equal to memory plus swap: '-1' to enable unlimited swap
... ...
@@ -23,8 +23,8 @@ Connect a container to a network
23 23
 Options:
24 24
       --alias value           Add network-scoped alias for the container (default [])
25 25
       --help                  Print usage
26
-      --ip string             IP Address
27
-      --ip6 string            IPv6 Address
26
+      --ip string             IPv4 address (e.g., 172.30.100.104)
27
+      --ip6 string            IPv6 address (e.g., 2001:db8::33)
28 28
       --link value            Add link to another container (default [])
29 29
       --link-local-ip value   Add a link-local address for the container (default [])
30 30
 ```
... ...
@@ -76,8 +76,8 @@ Options:
76 76
                                     the system uses bytes per second.
77 77
                                     --io-maxbandwidth and --io-maxiops are mutually exclusive options.
78 78
       --io-maxiops uint             Maximum IOps limit for the system drive (Windows only)
79
-      --ip string                   Container IPv4 address (e.g. 172.30.100.104)
80
-      --ip6 string                  Container IPv6 address (e.g. 2001:db8::33)
79
+      --ip string                   IPv4 address (e.g., 172.30.100.104)
80
+      --ip6 string                  IPv6 address (e.g., 2001:db8::33)
81 81
       --ipc string                  IPC namespace to use
82 82
       --isolation string            Container isolation technology
83 83
       --kernel-memory string        Kernel memory limit
... ...
@@ -87,7 +87,7 @@ Options:
87 87
       --link-local-ip value         Container IPv4/IPv6 link-local addresses (default [])
88 88
       --log-driver string           Logging driver for the container
89 89
       --log-opt value               Log driver options (default [])
90
-      --mac-address string          Container MAC address (e.g. 92:d0:c6:0a:29:33)
90
+      --mac-address string          Container MAC address (e.g., 92:d0:c6:0a:29:33)
91 91
   -m, --memory string               Memory limit
92 92
       --memory-reservation string   Memory soft limit
93 93
       --memory-swap string          Swap limit equal to memory plus swap: '-1' to enable unlimited swap
... ...
@@ -317,12 +317,12 @@ redirection on the host system.
317 317
    When set to true, keep stdin open even if not attached. The default is false.
318 318
 
319 319
 **--ip**=""
320
-   Sets the container's interface IPv4 address (e.g. 172.23.0.9)
320
+   Sets the container's interface IPv4 address (e.g., 172.23.0.9)
321 321
 
322 322
    It can only be used in conjunction with **--network** for user-defined networks
323 323
 
324 324
 **--ip6**=""
325
-   Sets the container's interface IPv6 address (e.g. 2001:db8::1b99)
325
+   Sets the container's interface IPv6 address (e.g., 2001:db8::1b99)
326 326
 
327 327
    It can only be used in conjunction with **--network** for user-defined networks
328 328
 
... ...
@@ -401,7 +401,7 @@ the value of --memory.
401 401
 unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap.
402 402
 
403 403
 **--mac-address**=""
404
-   Container MAC address (e.g. 92:d0:c6:0a:29:33)
404
+   Container MAC address (e.g., 92:d0:c6:0a:29:33)
405 405
 
406 406
    Remember that the MAC address in an Ethernet network must be unique.
407 407
 The IPv6 link-local address will be based on the device's MAC address