mirror of https://github.com/docker/cli.git
Docs: update filter options for docker container ps
The `is-task` filter was only documented in the usage section, but this section is not used in the documentation. This patch adds the missing filter, synchronises the man page source, and does some slight rephrasing and reformatting of the filters. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2dac00bdca
commit
46064f33f4
|
@ -84,18 +84,19 @@ The currently supported filters are:
|
||||||
|
|
||||||
| Filter | Description |
|
| Filter | Description |
|
||||||
|:----------------------|:-------------------------------------------------------------------------------------------------------------------------------------|
|
|:----------------------|:-------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `id` | container's ID |
|
| `id` | Container's ID |
|
||||||
| `name` | container's name |
|
| `name` | Container's name |
|
||||||
| `label` | An arbitrary string representing either a key or a key-value pair |
|
| `label` | An arbitrary string representing either a key or a key-value pair. Expressed as `<key>` or `<key>=<value>` |
|
||||||
| `exited` | An integer representing the container's exit code. Only useful with `--all`. |
|
| `exited` | An integer representing the container's exit code. Only useful with `--all`. |
|
||||||
| `status` | One of `created|restarting|running|removing|paused|exited|dead` |
|
| `status` | One of `created`, `restarting`, `running`, `removing`, `paused`, `exited`, or `dead` |
|
||||||
| `ancestor` | Filters containers which share a given image as an ancestor. Expressed as `<image-name>[:<tag>]`, `<image id>`, or `<image@digest>` |
|
| `ancestor` | Filters containers which share a given image as an ancestor. Expressed as `<image-name>[:<tag>]`, `<image id>`, or `<image@digest>` |
|
||||||
| `before` or `since` | Filters containers created before or after a given container ID or name |
|
| `before` or `since` | Filters containers created before or after a given container ID or name |
|
||||||
| `volume` | Filters running containers which have mounted a given volume or bind mount. |
|
| `volume` | Filters running containers which have mounted a given volume or bind mount. |
|
||||||
| `network` | Filters running containers connected to a given network. |
|
| `network` | Filters running containers connected to a given network. |
|
||||||
| `publish` or `expose` | Filters containers which publish or expose a given port. |
|
| `publish` or `expose` | Filters containers which publish or expose a given port. Expressed as `<port>[/<proto>]` or `<startport-endport>/[<proto>]` |
|
||||||
| `health` | One of `starting|healthy|unhealthy|none`. Filters containers based on their healthcheck status. |
|
| `health` | Filters containers based on their healthcheck status. One of `starting`, `healthy`, `unhealthy` or `none`. |
|
||||||
| `isolation` | Windows daemon only. One of `default|process|hyperv`. |
|
| `isolation` | Windows daemon only. One of `default`, `process`, or `hyperv`. |
|
||||||
|
| `is-task` | Filters containers that are a "task" for a service. Boolean option (`true` or `false`) |
|
||||||
|
|
||||||
|
|
||||||
#### label
|
#### label
|
||||||
|
@ -208,11 +209,11 @@ CONTAINER ID IMAGE COMMAND CREATED
|
||||||
The `ancestor` filter matches containers based on its image or a descendant of
|
The `ancestor` filter matches containers based on its image or a descendant of
|
||||||
it. The filter supports the following image representation:
|
it. The filter supports the following image representation:
|
||||||
|
|
||||||
- image
|
- `image`
|
||||||
- image:tag
|
- `image:tag`
|
||||||
- image:tag@digest
|
- `image:tag@digest`
|
||||||
- short-id
|
- `short-id`
|
||||||
- full-id
|
- `full-id`
|
||||||
|
|
||||||
If you don't specify a `tag`, the `latest` tag is used. For example, to filter
|
If you don't specify a `tag`, the `latest` tag is used. For example, to filter
|
||||||
for containers that use the latest `ubuntu` image:
|
for containers that use the latest `ubuntu` image:
|
||||||
|
|
|
@ -4,39 +4,46 @@ the running containers.
|
||||||
## Filters
|
## Filters
|
||||||
|
|
||||||
Filter output based on these conditions:
|
Filter output based on these conditions:
|
||||||
- exited=<int> an exit code of <int>
|
- ancestor=(<image-name>[:tag]|<image-id>|<image@digest>)
|
||||||
- label=<key> or label=<key>=<value>
|
containers created from an image or a descendant.
|
||||||
- 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>)
|
- before=(<container-name>|<container-id>)
|
||||||
|
- expose=(<port>[/<proto>]|<startport-endport>/[<proto>])
|
||||||
|
- exited=<int> an exit code of <int>
|
||||||
|
- health=(starting|healthy|unhealthy|none)
|
||||||
|
- id=<ID> a container's ID
|
||||||
|
- isolation=(`default`|`process`|`hyperv`) (Windows daemon only)
|
||||||
|
- is-task=(true|false)
|
||||||
|
- label=<key> or label=<key>=<value>
|
||||||
|
- name=<string> a container's name
|
||||||
|
- network=(<network-id>|<network-name>)
|
||||||
|
- publish=(<port>[/<proto>]|<startport-endport>/[<proto>])
|
||||||
- since=(<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.
|
- status=(created|restarting|removing|running|paused|exited)
|
||||||
- volume=(<volume-name>|<mount-point-destination>)
|
- volume=(<volume name>|<mount point destination>)
|
||||||
- network=(<network-name>|<network-id>) - containers connected to the provided network
|
|
||||||
- health=(starting|healthy|unhealthy|none) - filters containers based on healthcheck status
|
|
||||||
- publish=(<port>[/<proto>]|<startport-endport>/[<proto>]) - filters containers based on published ports
|
|
||||||
- expose=(<port>[/<proto>]|<startport-endport>/[<proto>]) - filters containers based on exposed ports
|
|
||||||
|
|
||||||
## Format
|
## Format
|
||||||
|
|
||||||
Pretty-print containers using a Go template.
|
The formatting option (**--format**) pretty-prints container output
|
||||||
Valid placeholders:
|
using a Go template.
|
||||||
.ID - Container ID
|
|
||||||
.Image - Image ID
|
Valid placeholders for the Go template are listed below:
|
||||||
.Command - Quoted command
|
- .ID - Container ID.
|
||||||
.CreatedAt - Time when the container was created.
|
- .Image - Image ID.
|
||||||
.RunningFor - Elapsed time since the container was started.
|
- .Command - Quoted command.
|
||||||
.Ports - Exposed ports.
|
- .CreatedAt - Time when the container was created.
|
||||||
.Status - Container status.
|
- .RunningFor - Elapsed time since the container was started.
|
||||||
.Size - Container disk size.
|
- .Ports - Exposed ports.
|
||||||
.Names - Container names.
|
- .Status - Container status.
|
||||||
.Labels - All labels assigned to the container.
|
- .Size - Container disk size.
|
||||||
.Label - Value of a specific label for this container. For example `{{.Label "com.docker.swarm.cpu"}}`
|
- .Names - Container names.
|
||||||
.Mounts - Names of the volumes mounted in this container.
|
- .Labels - All labels assigned to the container.
|
||||||
|
- .Label - Value of a specific label for this container.
|
||||||
|
For example **'{{.Label "com.docker.swarm.cpu"}}'**.
|
||||||
|
- .Mounts - Names of the volumes mounted in this container.
|
||||||
|
- .Networks - Names of the networks attached to this container.
|
||||||
|
|
||||||
# EXAMPLES
|
# EXAMPLES
|
||||||
|
|
||||||
## Display all containers, including non-running
|
## Display all containers, including non-running
|
||||||
|
|
||||||
$ docker container ls -a
|
$ docker container ls -a
|
||||||
|
|
Loading…
Reference in New Issue