0a0dd116 |
% DOCKER(1) Docker User Manuals |
b07f1938 |
% Docker Community |
401e93bb |
% FEBRUARY 2015 |
0a0dd116 |
# NAME
docker-ps - List containers
# SYNOPSIS |
b07f1938 |
**docker ps** |
e6115a6c |
[**-a**|**--all**] |
018e75a6 |
[**-f**|**--filter**[=*[]*]] |
14e88986 |
[**--format**=*"TEMPLATE"*]
[**--help**] |
e6115a6c |
[**-l**|**--latest**] |
b07f1938 |
[**-n**[=*-1*]] |
e6115a6c |
[**--no-trunc**]
[**-q**|**--quiet**]
[**-s**|**--size**] |
0a0dd116 |
# DESCRIPTION
|
73214144 |
List the containers in the local repository. By default this shows only |
0a0dd116 |
the running containers.
# OPTIONS
**-a**, **--all**=*true*|*false* |
b07f1938 |
Show all containers. Only running containers are shown by default. The default is *false*. |
0a0dd116 |
|
018e75a6 |
**-f**, **--filter**=[] |
d7dc4396 |
Filter output based on these conditions:
- exited=<int> an exit code of <int>
- label=<key> or label=<key>=<value> |
859262a8 |
- status=(created|restarting|running|paused|exited|dead) |
d7dc4396 |
- name=<string> a container's name
- id=<ID> a container's ID
- 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. |
bd4fb00f |
- volume=(<volume-name>|<mount-point-destination>) |
018e75a6 |
|
d7904696 |
**--format**="*TEMPLATE*" |
14e88986 |
Pretty-print containers using a Go template.
Valid placeholders:
.ID - Container ID
.Image - Image ID
.Command - Quoted command
.CreatedAt - Time when the container was created.
.RunningFor - Elapsed time since the container was started.
.Ports - Exposed ports.
.Status - Container status.
.Size - Container disk size. |
22d22eb9 |
.Names - Container names. |
927b334e |
.Labels - All labels assigned to the container. |
14e88986 |
.Label - Value of a specific label for this container. For example `{{.Label "com.docker.swarm.cpu"}}` |
bd4fb00f |
.Mounts - Names of the volumes mounted in this container. |
14e88986 |
**--help**
Print usage statement
|
0a0dd116 |
**-l**, **--latest**=*true*|*false* |
1921c629 |
Show only the latest created container (includes all states). The default is *false*. |
0a0dd116 |
|
d7904696 |
**-n**=*-1* |
1921c629 |
Show n last created containers (includes all states). |
0a0dd116 |
**--no-trunc**=*true*|*false* |
b07f1938 |
Don't truncate output. The default is *false*. |
0a0dd116 |
**-q**, **--quiet**=*true*|*false* |
b07f1938 |
Only display numeric IDs. The default is *false*. |
0a0dd116 |
**-s**, **--size**=*true*|*false* |
762ffda9 |
Display total file sizes. The default is *false*. |
0a0dd116 |
|
b07f1938 |
# EXAMPLES |
0a0dd116 |
# Display all containers, including non-running
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a87ecb4f327c fedora:20 /bin/sh -c #(nop) MA 20 minutes ago Exit 0 desperate_brattain
01946d9d34d8 vpavlin/rhel7:latest /bin/sh -c #(nop) MA 33 minutes ago Exit 0 thirsty_bell
c1d3b0166030 acffc0358b9e /bin/sh -c yum -y up 2 weeks ago Exit 1 determined_torvalds
41d50ecd2f57 fedora:20 /bin/sh -c #(nop) MA 2 weeks ago Exit 0 drunk_pike
# Display only IDs of all containers, including non-running
# docker ps -a -q
a87ecb4f327c
01946d9d34d8
c1d3b0166030
41d50ecd2f57
|
401e93bb |
# Display only IDs of all containers that have the name `determined_torvalds`
# docker ps -a -q --filter=name=determined_torvalds
c1d3b0166030
|
37209190 |
# Display containers with their commands
# docker ps --format "{{.ID}}: {{.Command}}"
a87ecb4f327c: /bin/sh -c #(nop) MA
01946d9d34d8: /bin/sh -c #(nop) MA
c1d3b0166030: /bin/sh -c yum -y up
41d50ecd2f57: /bin/sh -c #(nop) MA
# Display containers with their labels in a table
# docker ps --format "table {{.ID}}\t{{.Labels}}"
CONTAINER ID LABELS
a87ecb4f327c com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd
01946d9d34d8
c1d3b0166030 com.docker.swarm.node=debian,com.docker.swarm.cpu=6
41d50ecd2f57 com.docker.swarm.node=fedora,com.docker.swarm.cpu=3,com.docker.swarm.storage=ssd
# Display containers with their node label in a table
# docker ps --format 'table {{.ID}}\t{{(.Label "com.docker.swarm.node")}}'
CONTAINER ID NODE
a87ecb4f327c ubuntu
01946d9d34d8
c1d3b0166030 debian
41d50ecd2f57 fedora
|
bd4fb00f |
# 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
|
0a0dd116 |
# HISTORY
April 2014, Originally compiled by William Henry (whenry at redhat dot com) |
fa29b1f0 |
based on docker.com source material and internal work. |
b07f1938 |
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> |
018e75a6 |
August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> |
e01baa6b |
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> |
401e93bb |
February 2015, updated by André Martins <martins@noironetworks.com> |