Add filter for network ls to hide predefined net

Add filter support for `network ls` to hide predefined network,
then user can use "docker network rm `docker network ls -f type=custom`"
to delete a bundle of userdefined networks.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 26dd026bd70c9c18a16b0e339821c309e56d8ff0
Component: engine
This commit is contained in:
Zhang Wei
2015-11-10 16:57:06 +08:00
parent f88ae3fe07
commit 6f10e6b229
13 changed files with 405 additions and 33 deletions

View File

@ -109,6 +109,7 @@ This section lists each version from latest to oldest. Each listing includes a
the push or pull completes.
* `POST /containers/create` now allows you to set a read/write rate limit for a
device (in bytes per second or IO per second).
* `GET /networks` now supports filtering by `name`, `id` and `type`.
### v1.21 API changes

View File

@ -2728,7 +2728,7 @@ Status Codes
**Example request**:
GET /networks HTTP/1.1
GET /networks?filters={"type":{"custom":true}} HTTP/1.1
**Example response**:
@ -2794,11 +2794,12 @@ Content-Type: application/json
]
```
Query Parameters:
- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the networks list. Available filters: `name=[network-names]` , `id=[network-ids]`
- **filters** - JSON encoded network list filter. The filter value is one of:
- `name=<network-name>` Matches all or part of a network name.
- `id=<network-id>` Matches all or part of a network id.
- `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks.
Status Codes: