From cd547751dff7376b262fb980d1fed3b62971a4b5 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 28 Sep 2016 12:45:30 +0200 Subject: [PATCH] Add a new "is-task" ps filter This makes it easier to list containers that are part of a task (swarm mode) and those who are not. Signed-off-by: Vincent Demeester --- contrib/completion/bash/docker | 4 ++++ contrib/completion/zsh/_docker | 3 +++ docs/reference/commandline/ps.md | 1 + man/docker-ps.1.md | 1 + 4 files changed, 9 insertions(+) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 2c2a95fe04..23f56fcc14 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -2181,6 +2181,10 @@ _docker_ps() { __docker_complete_container_ids return ;; + is-task) + COMPREPLY=( $( compgen -W "true false" -- "${cur##*=}" ) ) + return + ;; name) cur="${cur##*=}" __docker_complete_container_names diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index 6f1c660bc1..535f1f1ec2 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -333,6 +333,9 @@ __docker_complete_ps_filters() { (id) __docker_containers_ids && ret=0 ;; + (is-task) + _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 + ;; (name) __docker_containers_names && ret=0 ;; diff --git a/docs/reference/commandline/ps.md b/docs/reference/commandline/ps.md index 1f3ceb3799..541979e819 100644 --- a/docs/reference/commandline/ps.md +++ b/docs/reference/commandline/ps.md @@ -27,6 +27,7 @@ Options: - since=(|) - ancestor=([:tag]||) containers created from an image or a descendant. + - is-task=(true|false) --format string Pretty-print containers using a Go template --help Print usage -n, --last int Show n last created containers (includes all states) (default -1) diff --git a/man/docker-ps.1.md b/man/docker-ps.1.md index 14c770121f..fd6c4e78fa 100644 --- a/man/docker-ps.1.md +++ b/man/docker-ps.1.md @@ -32,6 +32,7 @@ the running containers. - status=(created|restarting|running|paused|exited|dead) - name= a container's name - id= a container's ID + - is-task=(true|false) - containers that are a task (part of a service managed by swarm) - before=(|) - since=(|) - ancestor=([:tag]||) - containers created from an image or a descendant.