Add --filter scope=swarm|local for docker network ls
This fix tries to address the request in 31324 by adding
`--filter scope=swarm|local` for `docker network ls`.
As `docker network ls` has a `SCOPE` column by default,
it is natural to add the support of `--filter scope=swarm|local`.
This fix adds the `scope=swarm|local` support for
`docker network ls --filter`.
Related docs has been updated.
Additional unit test cases have been added.
This fix fixes 31324.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 6f22676f0b
Component: cli
This commit is contained in:
@@ -74,6 +74,7 @@ The currently supported filters are:
|
||||
* id (network's id)
|
||||
* label (`label=<key>` or `label=<key>=<value>`)
|
||||
* name (network's name)
|
||||
* scope (`swarm|global|local`)
|
||||
* type (`custom|builtin`)
|
||||
|
||||
#### Driver
|
||||
@@ -157,6 +158,30 @@ NETWORK ID NAME DRIVER SCOPE
|
||||
06e7eef0a170 foobar bridge local
|
||||
```
|
||||
|
||||
#### Scope
|
||||
|
||||
The `scope` filter matches networks based on their scope.
|
||||
|
||||
The following example matches networks with the `swarm` scope:
|
||||
|
||||
```bash
|
||||
$ docker network ls --filter scope=swarm
|
||||
NETWORK ID NAME DRIVER SCOPE
|
||||
xbtm0v4f1lfh ingress overlay swarm
|
||||
ic6r88twuu92 swarmnet overlay swarm
|
||||
```
|
||||
|
||||
The following example matches networks with the `local` scope:
|
||||
|
||||
```bash
|
||||
$ docker network ls --filter scope=local
|
||||
NETWORK ID NAME DRIVER SCOPE
|
||||
e85227439ac7 bridge bridge local
|
||||
0ca0e19443ed host host local
|
||||
ca13cc149a36 localnet bridge local
|
||||
f9e115d2de35 none null local
|
||||
```
|
||||
|
||||
#### Type
|
||||
|
||||
The `type` filter supports two values; `builtin` displays predefined networks
|
||||
|
||||
@@ -35,6 +35,7 @@ The currently supported filters are:
|
||||
* id (network's id)
|
||||
* label (`label=<key>` or `label=<key>=<value>`)
|
||||
* name (network's name)
|
||||
* scope (`swarm|global|local`)
|
||||
* type (custom|builtin)
|
||||
|
||||
#### Driver
|
||||
@@ -118,6 +119,30 @@ NETWORK ID NAME DRIVER
|
||||
06e7eef0a170 foobar bridge
|
||||
```
|
||||
|
||||
#### Scope
|
||||
|
||||
The `scope` filter matches networks based on their scope.
|
||||
|
||||
The following example matches networks with the `swarm` scope:
|
||||
|
||||
```bash
|
||||
$ docker network ls --filter scope=swarm
|
||||
NETWORK ID NAME DRIVER SCOPE
|
||||
xbtm0v4f1lfh ingress overlay swarm
|
||||
ic6r88twuu92 swarmnet overlay swarm
|
||||
```
|
||||
|
||||
The following example matches networks with the `local` scope:
|
||||
|
||||
```bash
|
||||
$ docker network ls --filter scope=local
|
||||
NETWORK ID NAME DRIVER SCOPE
|
||||
e85227439ac7 bridge bridge local
|
||||
0ca0e19443ed host host local
|
||||
ca13cc149a36 localnet bridge local
|
||||
f9e115d2de35 none null local
|
||||
```
|
||||
|
||||
#### Type
|
||||
|
||||
The `type` filter supports two values; `builtin` displays predefined networks
|
||||
|
||||
Reference in New Issue
Block a user