Browse code

better command `docker network create -h` output

Signed-off-by: allencloud <allen.sun@daocloud.io>

allencloud authored on 2016/07/16 16:32:17
Showing 6 changed files
... ...
@@ -53,16 +53,16 @@ func newCreateCommand(dockerCli *client.DockerCli) *cobra.Command {
53 53
 	flags.StringVarP(&opts.driver, "driver", "d", "bridge", "Driver to manage the Network")
54 54
 	flags.VarP(&opts.driverOpts, "opt", "o", "Set driver specific options")
55 55
 	flags.StringSliceVar(&opts.labels, "label", []string{}, "Set metadata on a network")
56
-	flags.BoolVar(&opts.internal, "internal", false, "restricts external access to the network")
57
-	flags.BoolVar(&opts.ipv6, "ipv6", false, "enable IPv6 networking")
56
+	flags.BoolVar(&opts.internal, "internal", false, "Restrict external access to the network")
57
+	flags.BoolVar(&opts.ipv6, "ipv6", false, "Enable IPv6 networking")
58 58
 
59 59
 	flags.StringVar(&opts.ipamDriver, "ipam-driver", "default", "IP Address Management Driver")
60
-	flags.StringSliceVar(&opts.ipamSubnet, "subnet", []string{}, "subnet in CIDR format that represents a network segment")
61
-	flags.StringSliceVar(&opts.ipamIPRange, "ip-range", []string{}, "allocate container ip from a sub-range")
62
-	flags.StringSliceVar(&opts.ipamGateway, "gateway", []string{}, "ipv4 or ipv6 Gateway for the master subnet")
60
+	flags.StringSliceVar(&opts.ipamSubnet, "subnet", []string{}, "Subnet in CIDR format that represents a network segment")
61
+	flags.StringSliceVar(&opts.ipamIPRange, "ip-range", []string{}, "Allocate container ip from a sub-range")
62
+	flags.StringSliceVar(&opts.ipamGateway, "gateway", []string{}, "IPv4 or IPv6 Gateway for the master subnet")
63 63
 
64
-	flags.Var(&opts.ipamAux, "aux-address", "auxiliary ipv4 or ipv6 addresses used by Network driver")
65
-	flags.Var(&opts.ipamOpt, "ipam-opt", "set IPAM driver specific options")
64
+	flags.Var(&opts.ipamAux, "aux-address", "Auxiliary IPv4 or IPv6 addresses used by Network driver")
65
+	flags.Var(&opts.ipamOpt, "ipam-opt", "Set IPAM driver specific options")
66 66
 
67 67
 	return cmd
68 68
 }
... ...
@@ -16,19 +16,19 @@ Usage:	docker network create [OPTIONS]
16 16
 Create a network
17 17
 
18 18
 Options:
19
-      --aux-address value    auxiliary ipv4 or ipv6 addresses used by Network
19
+      --aux-address value    Auxiliary IPv4 or IPv6 addresses used by Network
20 20
                              driver (default map[])
21 21
   -d, --driver string        Driver to manage the Network (default "bridge")
22
-      --gateway value        ipv4 or ipv6 Gateway for the master subnet (default [])
22
+      --gateway value        IPv4 or IPv6 Gateway for the master subnet (default [])
23 23
       --help                 Print usage
24
-      --internal             restricts external access to the network
25
-      --ip-range value       allocate container ip from a sub-range (default [])
24
+      --internal             Restrict external access to the network
25
+      --ip-range value       Allocate container ip from a sub-range (default [])
26 26
       --ipam-driver string   IP Address Management Driver (default "default")
27
-      --ipam-opt value       set IPAM driver specific options (default map[])
28
-      --ipv6                 enable IPv6 networking
27
+      --ipam-opt value       Set IPAM driver specific options (default map[])
28
+      --ipv6                 Enable IPv6 networking
29 29
       --label value          Set metadata on a network (default [])
30 30
   -o, --opt value            Set driver specific options (default map[])
31
-      --subnet value         subnet in CIDR format that represents a
31
+      --subnet value         Subnet in CIDR format that represents a
32 32
                              network segment (default [])
33 33
 ```
34 34
 
... ...
@@ -163,9 +163,9 @@ network driver, again with their approximate equivalents to `docker daemon`.
163 163
 
164 164
 | Argument     | Equivalent     | Description                                |
165 165
 |--------------|----------------|--------------------------------------------|
166
-| `--gateway`  | -              | ipv4 or ipv6 Gateway for the master subnet |
166
+| `--gateway`  | -              | IPv4 or IPv6 Gateway for the master subnet |
167 167
 | `--ip-range` | `--fixed-cidr` | Allocate IPs from a range                  |
168
-| `--internal` | -              | Restricts external access to the network   |
168
+| `--internal` | -              | Restrict external access to the network   |
169 169
 | `--ipv6`     | `--ipv6`       | Enable IPv6 networking                     |
170 170
 | `--subnet`   | `--bip`        | Subnet for network                         |
171 171
 
... ...
@@ -596,7 +596,7 @@ root@3cce0d3575f3:/# ip -6 route
596 596
 default via 2001:db8:abc9::22 dev eth0  metric 1024
597 597
 ```
598 598
 
599
-Start a second container with a specific `--ip4` address and ping the first host using ipv4 packets:
599
+Start a second container with a specific `--ip4` address and ping the first host using IPv4 packets:
600 600
 
601 601
 ```
602 602
 docker run --net=ipvlan140 --ip=192.168.140.10 -it --rm alpine /bin/sh
... ...
@@ -144,19 +144,19 @@ to create an externally isolated `overlay` network, you can specify the
144 144
 
145 145
 # OPTIONS
146 146
 **--aux-address**=map[]
147
-  Auxiliary ipv4 or ipv6 addresses used by network driver
147
+  Auxiliary IPv4 or IPv6 addresses used by network driver
148 148
 
149 149
 **-d**, **--driver**=*DRIVER*
150 150
   Driver to manage the Network bridge or overlay. The default is bridge.
151 151
 
152 152
 **--gateway**=[]
153
-  ipv4 or ipv6 Gateway for the master subnet
153
+  IPv4 or IPv6 Gateway for the master subnet
154 154
 
155 155
 **--help**
156 156
   Print usage
157 157
 
158 158
 **--internal**
159
-  Restricts external access to the network
159
+  Restrict external access to the network
160 160
 
161 161
 **--ip-range**=[]
162 162
   Allocate container ip from a sub-range
... ...
@@ -57,7 +57,7 @@ func ParseAdvertise(advertise string) (string, error) {
57 57
 		return advertise, nil
58 58
 	}
59 59
 
60
-	// If advertise is a valid interface name, get the valid ipv4 address and use it to advertise
60
+	// If advertise is a valid interface name, get the valid IPv4 address and use it to advertise
61 61
 	ifaceName := addr
62 62
 	iface, err = net.InterfaceByName(ifaceName)
63 63
 	if err != nil {
... ...
@@ -47,7 +47,7 @@ func doesEnvExist(name string) bool {
47 47
 }
48 48
 
49 49
 // ValidateExtraHost validates that the specified string is a valid extrahost and returns it.
50
-// ExtraHost is in the form of name:ip where the ip has to be a valid ip (ipv4 or ipv6).
50
+// ExtraHost is in the form of name:ip where the ip has to be a valid ip (IPv4 or IPv6).
51 51
 func ValidateExtraHost(val string) (string, error) {
52 52
 	// allow for IPv6 addresses in extra hosts by only splitting on first ":"
53 53
 	arr := strings.SplitN(val, ":", 2)