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 <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2016-09-28 12:45:30 +02:00 committed by Tibor Vass
parent 247a2f112b
commit cd547751df
4 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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
;;

View File

@ -27,6 +27,7 @@ Options:
- since=(<container-name>|<container-id>)
- ancestor=(<image-name>[:tag]|<image-id>|<image@digest>)
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)

View File

@ -32,6 +32,7 @@ the running containers.
- status=(created|restarting|running|paused|exited|dead)
- name=<string> a container's name
- id=<ID> a container's ID
- is-task=(true|false) - containers that are a task (part of a service managed by swarm)
- before=(<container-name>|<container-id>)
- since=(<container-name>|<container-id>)
- ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - containers created from an image or a descendant.