2014-04-16 18:07:55 +00:00
|
|
|
% DOCKER(1) Docker User Manuals
|
2014-07-01 02:58:04 +00:00
|
|
|
% Docker Community
|
2015-02-19 15:18:58 +00:00
|
|
|
% FEBRUARY 2015
|
2014-04-16 18:07:55 +00:00
|
|
|
# NAME
|
|
|
|
docker-ps - List containers
|
|
|
|
|
|
|
|
# SYNOPSIS
|
2014-07-01 02:58:04 +00:00
|
|
|
**docker ps**
|
2015-12-23 14:37:06 +00:00
|
|
|
[**-a**|**--all**]
|
2014-08-17 23:31:58 +00:00
|
|
|
[**-f**|**--filter**[=*[]*]]
|
2015-10-03 15:56:41 +00:00
|
|
|
[**--format**=*"TEMPLATE"*]
|
|
|
|
[**--help**]
|
2015-12-23 14:37:06 +00:00
|
|
|
[**-l**|**--latest**]
|
2014-07-01 02:58:04 +00:00
|
|
|
[**-n**[=*-1*]]
|
2015-12-23 14:37:06 +00:00
|
|
|
[**--no-trunc**]
|
|
|
|
[**-q**|**--quiet**]
|
|
|
|
[**-s**|**--size**]
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
2015-07-20 15:46:50 +00:00
|
|
|
List the containers in the local repository. By default this shows only
|
2014-04-16 18:07:55 +00:00
|
|
|
the running containers.
|
|
|
|
|
|
|
|
# OPTIONS
|
|
|
|
**-a**, **--all**=*true*|*false*
|
2014-07-01 02:58:04 +00:00
|
|
|
Show all containers. Only running containers are shown by default. The default is *false*.
|
2014-04-16 18:07:55 +00:00
|
|
|
|
2014-08-17 23:31:58 +00:00
|
|
|
**-f**, **--filter**=[]
|
2015-12-03 07:16:53 +00:00
|
|
|
Filter output based on these conditions:
|
|
|
|
- exited=<int> an exit code of <int>
|
|
|
|
- label=<key> or label=<key>=<value>
|
2016-01-13 16:34:18 +00:00
|
|
|
- status=(created|restarting|running|paused|exited|dead)
|
2015-12-03 07:16:53 +00:00
|
|
|
- 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.
|
2016-02-03 22:46:01 +00:00
|
|
|
- volume=(<volume-name>|<mount-point-destination>)
|
2016-06-06 00:04:33 +00:00
|
|
|
- network=(<network-name>|<network-id>) - containers connected to the provided network
|
2014-08-17 23:31:58 +00:00
|
|
|
|
2015-11-10 01:33:55 +00:00
|
|
|
**--format**="*TEMPLATE*"
|
2015-10-03 15:56:41 +00:00
|
|
|
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.
|
2016-02-19 15:13:34 +00:00
|
|
|
.Names - Container names.
|
2015-12-13 16:00:39 +00:00
|
|
|
.Labels - All labels assigned to the container.
|
2015-10-03 15:56:41 +00:00
|
|
|
.Label - Value of a specific label for this container. For example `{{.Label "com.docker.swarm.cpu"}}`
|
2016-02-03 22:46:01 +00:00
|
|
|
.Mounts - Names of the volumes mounted in this container.
|
2015-10-03 15:56:41 +00:00
|
|
|
|
|
|
|
**--help**
|
|
|
|
Print usage statement
|
|
|
|
|
2014-04-16 18:07:55 +00:00
|
|
|
**-l**, **--latest**=*true*|*false*
|
2015-11-05 07:08:00 +00:00
|
|
|
Show only the latest created container (includes all states). The default is *false*.
|
2014-04-16 18:07:55 +00:00
|
|
|
|
2015-11-10 01:33:55 +00:00
|
|
|
**-n**=*-1*
|
2015-11-05 07:08:00 +00:00
|
|
|
Show n last created containers (includes all states).
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
**--no-trunc**=*true*|*false*
|
2014-07-01 02:58:04 +00:00
|
|
|
Don't truncate output. The default is *false*.
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
**-q**, **--quiet**=*true*|*false*
|
2014-07-01 02:58:04 +00:00
|
|
|
Only display numeric IDs. The default is *false*.
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
**-s**, **--size**=*true*|*false*
|
2014-11-04 16:49:39 +00:00
|
|
|
Display total file sizes. The default is *false*.
|
2014-04-16 18:07:55 +00:00
|
|
|
|
2014-07-01 02:58:04 +00:00
|
|
|
# EXAMPLES
|
2014-04-16 18:07:55 +00:00
|
|
|
# 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
|
|
|
|
|
2015-02-19 15:18:58 +00:00
|
|
|
# Display only IDs of all containers that have the name `determined_torvalds`
|
|
|
|
|
|
|
|
# docker ps -a -q --filter=name=determined_torvalds
|
|
|
|
c1d3b0166030
|
|
|
|
|
2015-05-01 21:23:27 +00:00
|
|
|
# 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
|
|
|
|
|
2016-02-03 22:46:01 +00:00
|
|
|
# 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
|
|
|
|
|
2014-04-16 18:07:55 +00:00
|
|
|
# HISTORY
|
|
|
|
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
2014-07-02 00:30:25 +00:00
|
|
|
based on docker.com source material and internal work.
|
2014-07-01 02:58:04 +00:00
|
|
|
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2014-08-17 23:31:58 +00:00
|
|
|
August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2014-11-28 04:21:55 +00:00
|
|
|
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2015-02-19 15:18:58 +00:00
|
|
|
February 2015, updated by André Martins <martins@noironetworks.com>
|