mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
better command docker network create -h
output
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
9ad857a788
commit
d0081a0f47
6 changed files with 22 additions and 22 deletions
|
@ -53,16 +53,16 @@ func newCreateCommand(dockerCli *client.DockerCli) *cobra.Command {
|
||||||
flags.StringVarP(&opts.driver, "driver", "d", "bridge", "Driver to manage the Network")
|
flags.StringVarP(&opts.driver, "driver", "d", "bridge", "Driver to manage the Network")
|
||||||
flags.VarP(&opts.driverOpts, "opt", "o", "Set driver specific options")
|
flags.VarP(&opts.driverOpts, "opt", "o", "Set driver specific options")
|
||||||
flags.StringSliceVar(&opts.labels, "label", []string{}, "Set metadata on a network")
|
flags.StringSliceVar(&opts.labels, "label", []string{}, "Set metadata on a network")
|
||||||
flags.BoolVar(&opts.internal, "internal", false, "restricts external access to the network")
|
flags.BoolVar(&opts.internal, "internal", false, "Restrict external access to the network")
|
||||||
flags.BoolVar(&opts.ipv6, "ipv6", false, "enable IPv6 networking")
|
flags.BoolVar(&opts.ipv6, "ipv6", false, "Enable IPv6 networking")
|
||||||
|
|
||||||
flags.StringVar(&opts.ipamDriver, "ipam-driver", "default", "IP Address Management Driver")
|
flags.StringVar(&opts.ipamDriver, "ipam-driver", "default", "IP Address Management Driver")
|
||||||
flags.StringSliceVar(&opts.ipamSubnet, "subnet", []string{}, "subnet in CIDR format that represents a network segment")
|
flags.StringSliceVar(&opts.ipamSubnet, "subnet", []string{}, "Subnet in CIDR format that represents a network segment")
|
||||||
flags.StringSliceVar(&opts.ipamIPRange, "ip-range", []string{}, "allocate container ip from a sub-range")
|
flags.StringSliceVar(&opts.ipamIPRange, "ip-range", []string{}, "Allocate container ip from a sub-range")
|
||||||
flags.StringSliceVar(&opts.ipamGateway, "gateway", []string{}, "ipv4 or ipv6 Gateway for the master subnet")
|
flags.StringSliceVar(&opts.ipamGateway, "gateway", []string{}, "IPv4 or IPv6 Gateway for the master subnet")
|
||||||
|
|
||||||
flags.Var(&opts.ipamAux, "aux-address", "auxiliary ipv4 or ipv6 addresses used by Network driver")
|
flags.Var(&opts.ipamAux, "aux-address", "Auxiliary IPv4 or IPv6 addresses used by Network driver")
|
||||||
flags.Var(&opts.ipamOpt, "ipam-opt", "set IPAM driver specific options")
|
flags.Var(&opts.ipamOpt, "ipam-opt", "Set IPAM driver specific options")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,19 +16,19 @@ Usage: docker network create [OPTIONS]
|
||||||
Create a network
|
Create a network
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--aux-address value auxiliary ipv4 or ipv6 addresses used by Network
|
--aux-address value Auxiliary IPv4 or IPv6 addresses used by Network
|
||||||
driver (default map[])
|
driver (default map[])
|
||||||
-d, --driver string Driver to manage the Network (default "bridge")
|
-d, --driver string Driver to manage the Network (default "bridge")
|
||||||
--gateway value ipv4 or ipv6 Gateway for the master subnet (default [])
|
--gateway value IPv4 or IPv6 Gateway for the master subnet (default [])
|
||||||
--help Print usage
|
--help Print usage
|
||||||
--internal restricts external access to the network
|
--internal Restrict external access to the network
|
||||||
--ip-range value allocate container ip from a sub-range (default [])
|
--ip-range value Allocate container ip from a sub-range (default [])
|
||||||
--ipam-driver string IP Address Management Driver (default "default")
|
--ipam-driver string IP Address Management Driver (default "default")
|
||||||
--ipam-opt value set IPAM driver specific options (default map[])
|
--ipam-opt value Set IPAM driver specific options (default map[])
|
||||||
--ipv6 enable IPv6 networking
|
--ipv6 Enable IPv6 networking
|
||||||
--label value Set metadata on a network (default [])
|
--label value Set metadata on a network (default [])
|
||||||
-o, --opt value Set driver specific options (default map[])
|
-o, --opt value Set driver specific options (default map[])
|
||||||
--subnet value subnet in CIDR format that represents a
|
--subnet value Subnet in CIDR format that represents a
|
||||||
network segment (default [])
|
network segment (default [])
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -163,9 +163,9 @@ network driver, again with their approximate equivalents to `docker daemon`.
|
||||||
|
|
||||||
| Argument | Equivalent | Description |
|
| Argument | Equivalent | Description |
|
||||||
|--------------|----------------|--------------------------------------------|
|
|--------------|----------------|--------------------------------------------|
|
||||||
| `--gateway` | - | ipv4 or ipv6 Gateway for the master subnet |
|
| `--gateway` | - | IPv4 or IPv6 Gateway for the master subnet |
|
||||||
| `--ip-range` | `--fixed-cidr` | Allocate IPs from a range |
|
| `--ip-range` | `--fixed-cidr` | Allocate IPs from a range |
|
||||||
| `--internal` | - | Restricts external access to the network |
|
| `--internal` | - | Restrict external access to the network |
|
||||||
| `--ipv6` | `--ipv6` | Enable IPv6 networking |
|
| `--ipv6` | `--ipv6` | Enable IPv6 networking |
|
||||||
| `--subnet` | `--bip` | Subnet for network |
|
| `--subnet` | `--bip` | Subnet for network |
|
||||||
|
|
||||||
|
|
|
@ -596,7 +596,7 @@ root@3cce0d3575f3:/# ip -6 route
|
||||||
default via 2001:db8:abc9::22 dev eth0 metric 1024
|
default via 2001:db8:abc9::22 dev eth0 metric 1024
|
||||||
```
|
```
|
||||||
|
|
||||||
Start a second container with a specific `--ip4` address and ping the first host using ipv4 packets:
|
Start a second container with a specific `--ip4` address and ping the first host using IPv4 packets:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run --net=ipvlan140 --ip=192.168.140.10 -it --rm alpine /bin/sh
|
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
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
**--aux-address**=map[]
|
**--aux-address**=map[]
|
||||||
Auxiliary ipv4 or ipv6 addresses used by network driver
|
Auxiliary IPv4 or IPv6 addresses used by network driver
|
||||||
|
|
||||||
**-d**, **--driver**=*DRIVER*
|
**-d**, **--driver**=*DRIVER*
|
||||||
Driver to manage the Network bridge or overlay. The default is bridge.
|
Driver to manage the Network bridge or overlay. The default is bridge.
|
||||||
|
|
||||||
**--gateway**=[]
|
**--gateway**=[]
|
||||||
ipv4 or ipv6 Gateway for the master subnet
|
IPv4 or IPv6 Gateway for the master subnet
|
||||||
|
|
||||||
**--help**
|
**--help**
|
||||||
Print usage
|
Print usage
|
||||||
|
|
||||||
**--internal**
|
**--internal**
|
||||||
Restricts external access to the network
|
Restrict external access to the network
|
||||||
|
|
||||||
**--ip-range**=[]
|
**--ip-range**=[]
|
||||||
Allocate container ip from a sub-range
|
Allocate container ip from a sub-range
|
||||||
|
|
|
@ -57,7 +57,7 @@ func ParseAdvertise(advertise string) (string, error) {
|
||||||
return advertise, nil
|
return advertise, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If advertise is a valid interface name, get the valid ipv4 address and use it to advertise
|
// If advertise is a valid interface name, get the valid IPv4 address and use it to advertise
|
||||||
ifaceName := addr
|
ifaceName := addr
|
||||||
iface, err = net.InterfaceByName(ifaceName)
|
iface, err = net.InterfaceByName(ifaceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -47,7 +47,7 @@ func doesEnvExist(name string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateExtraHost validates that the specified string is a valid extrahost and returns it.
|
// ValidateExtraHost validates that the specified string is a valid extrahost and returns it.
|
||||||
// ExtraHost is in the form of name:ip where the ip has to be a valid ip (ipv4 or ipv6).
|
// ExtraHost is in the form of name:ip where the ip has to be a valid ip (IPv4 or IPv6).
|
||||||
func ValidateExtraHost(val string) (string, error) {
|
func ValidateExtraHost(val string) (string, error) {
|
||||||
// allow for IPv6 addresses in extra hosts by only splitting on first ":"
|
// allow for IPv6 addresses in extra hosts by only splitting on first ":"
|
||||||
arr := strings.SplitN(val, ":", 2)
|
arr := strings.SplitN(val, ":", 2)
|
||||||
|
|
Loading…
Reference in a new issue