From 6f22676f0bce0bba1c88d39d89188dbcd71b4156 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Fri, 3 Mar 2017 10:45:48 -0800 Subject: [PATCH] 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 --- docs/reference/commandline/network_ls.md | 25 ++++++++++++++++++++++++ man/src/network/ls.md | 25 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/docs/reference/commandline/network_ls.md b/docs/reference/commandline/network_ls.md index 39dcd051d9..8bb8a2c48a 100644 --- a/docs/reference/commandline/network_ls.md +++ b/docs/reference/commandline/network_ls.md @@ -74,6 +74,7 @@ The currently supported filters are: * id (network's id) * label (`label=` or `label==`) * 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 diff --git a/man/src/network/ls.md b/man/src/network/ls.md index c5182e87e1..417344951a 100644 --- a/man/src/network/ls.md +++ b/man/src/network/ls.md @@ -35,6 +35,7 @@ The currently supported filters are: * id (network's id) * label (`label=` or `label==`) * 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