Skip to content

Commit

Permalink
Add --filter scope=swarm|local for docker network ls
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
yongtang authored and Tibor Vass committed Jun 2, 2017
1 parent 9be3a2c commit 6f22676
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/reference/commandline/network_ls.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions man/src/network/ls.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6f22676

Please sign in to comment.