From d43b0f126935e2282684deba0aa727a78fd33957 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Fri, 3 Mar 2017 14:08:49 -0800 Subject: [PATCH] Support `--filter mode=global|replicated` for `docker service ls` This fix tries to address the request in 31325 by adding `--filter mode=global|replicated` to `docker service ls`. As `docker service ls` has a `MODE` column by default, it is natural to support `--filter mode=global|replicated` for `docker service ls`. There are multiple ways to address the issue. One way is to pass the filter of mode to SwarmKit, another way is to process the filter of mode in the daemon. This fix process the filter in the daemon. Related docs has been updated. An integration test has been added. This fix fixes 31325. Signed-off-by: Yong Tang --- docs/reference/commandline/service_ls.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/reference/commandline/service_ls.md b/docs/reference/commandline/service_ls.md index 86273ff1ff..6b07b84053 100644 --- a/docs/reference/commandline/service_ls.md +++ b/docs/reference/commandline/service_ls.md @@ -60,6 +60,7 @@ The currently supported filters are: * [id](service_ls.md#id) * [label](service_ls.md#label) +* [mode](service_ls.md#mode) * [name](service_ls.md#name) #### id @@ -98,6 +99,18 @@ ID NAME MODE REPLICAS IMAGE 74nzcxxjv6fq backend replicated 3/3 redis:3.0.6 ``` +#### mode + +The `mode` filter matches on the mode (either `replicated` or `global`) of a service. + +The following filter matches only `global` services. + +```bash +$ docker service ls --filter mode=global +ID NAME MODE REPLICAS IMAGE +w7y0v2yrn620 top global 1/1 busybox +``` + #### name The `name` filter matches on all or part of a service's name.