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