Add Subnets info for user-defined network

* If user doesn't specify the subnets to create a network, it will pick
  subnets from inside preferred pool. This PR aims to inspect these subnets info

* Add integration tests for docker inspect the subnets.

* docker-py project is already synchronized.

* jenkins checks depend on https://github.com/docker/docker-py/pull/888

Fixes issue #18626

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
This commit is contained in:
Wen Cheng Ma 2015-12-28 12:56:57 +08:00 committed by Tibor Vass
parent ad43730d0f
commit 9f64dc98bd
2 changed files with 55 additions and 2 deletions

View File

@ -17,7 +17,7 @@ parent = "smn_cli"
-f, --format= Format the output using the given go template.
--help Print usage
Returns information about one or more networks. By default, this command renders all results in a JSON object. For example, if you connect two containers to a network:
Returns information about one or more networks. By default, this command renders all results in a JSON object. For example, if you connect two containers to the default `bridge` network:
```bash
$ sudo docker run -itd --name=container1 busybox
@ -78,6 +78,32 @@ $ sudo docker network inspect bridge
]
```
Returns the information about the user-defined network:
```bash
$ docker network create simple-network
69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a
$ docker network inspect simple-network
[
{
"Name": "simple-network",
"Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a",
"Scope": "local",
"Driver": "bridge",
"IPAM": {
"Driver": "default",
"Config": [
{
"Subnet": "172.22.0.0/16",
"Gateway": "172.22.0.1/16"
}
]
},
"Containers": {},
"Options": {}
}
]
```
## Related information

View File

@ -12,7 +12,7 @@ NETWORK [NETWORK...]
# DESCRIPTION
Returns information about one or more networks. By default, this command renders all results in a JSON object. For example, if you connect two containers to a network:
Returns information about one or more networks. By default, this command renders all results in a JSON object. For example, if you connect two containers to the default `bridge` network:
```bash
$ sudo docker run -itd --name=container1 busybox
@ -73,6 +73,33 @@ $ sudo docker network inspect bridge
]
```
Returns the information about the user-defined network:
```bash
$ docker network create simple-network
69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a
$ docker network inspect simple-network
[
{
"Name": "simple-network",
"Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a",
"Scope": "local",
"Driver": "bridge",
"IPAM": {
"Driver": "default",
"Config": [
{
"Subnet": "172.22.0.0/16",
"Gateway": "172.22.0.1/16"
}
]
},
"Containers": {},
"Options": {}
}
]
```
# OPTIONS
**-f**, **--format**=""
Format the output using the given go template.