Add mounts to docker ps.

- Allow to filter containers by volume with `--filter volume=name` and `filter volume=/dest`.
- Show their names in the list with the custom format `{{ .Mounts }}`.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera
2017-06-02 00:07:30 +00:00
committed by Tibor Vass
parent 543ca10394
commit beb7b68810
2 changed files with 28 additions and 0 deletions
+14
View File
@@ -35,6 +35,7 @@ the running containers.
- 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.
- volume=(<volume-name>|<mount-point-destination>)
**--format**="*TEMPLATE*"
Pretty-print containers using a Go template.
@@ -50,6 +51,7 @@ the running containers.
.Names - Container names.
.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.
**--help**
Print usage statement
@@ -118,6 +120,18 @@ the running containers.
c1d3b0166030 debian
41d50ecd2f57 fedora
# Display containers with `remote-volume` mounted
$ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
CONTAINER ID MOUNTS
9c3527ed70ce remote-volume
# Display containers with a volume mounted in `/data`
$ docker ps --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}"
CONTAINER ID MOUNTS
9c3527ed70ce remote-volume
# HISTORY
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
based on docker.com source material and internal work.