github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/man/docker-ps.1.md (about) 1 % DOCKER(1) Docker User Manuals 2 % Docker Community 3 % FEBRUARY 2015 4 # NAME 5 docker-ps - List containers 6 7 # SYNOPSIS 8 **docker ps** 9 [**-a**|**--all**[=*false*]] 10 [**-f**|**--filter**[=*[]*]] 11 [**--format**=*"TEMPLATE"*] 12 [**--help**] 13 [**-l**|**--latest**[=*false*]] 14 [**-n**[=*-1*]] 15 [**--no-trunc**[=*false*]] 16 [**-q**|**--quiet**[=*false*]] 17 [**-s**|**--size**[=*false*]] 18 19 # DESCRIPTION 20 21 List the containers in the local repository. By default this shows only 22 the running containers. 23 24 # OPTIONS 25 **-a**, **--all**=*true*|*false* 26 Show all containers. Only running containers are shown by default. The default is *false*. 27 28 **-f**, **--filter**=[] 29 Provide filter values. Valid filters: 30 exited=<int> - containers with exit code of <int> 31 label=<key> or label=<key>=<value> 32 status=(created|restarting|running|paused|exited) 33 name=<string> - container's name 34 id=<ID> - container's ID 35 before=(<container-name>|<container-id>) 36 since=(<container-name>|<container-id>) 37 ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - filters containers that were 38 created from the given image or a descendant. 39 40 **--format**="*TEMPLATE*" 41 Pretty-print containers using a Go template. 42 Valid placeholders: 43 .ID - Container ID 44 .Image - Image ID 45 .Command - Quoted command 46 .CreatedAt - Time when the container was created. 47 .RunningFor - Elapsed time since the container was started. 48 .Ports - Exposed ports. 49 .Status - Container status. 50 .Size - Container disk size. 51 .Labels - All labels assigned to the container. 52 .Label - Value of a specific label for this container. For example `{{.Label "com.docker.swarm.cpu"}}` 53 54 **--help** 55 Print usage statement 56 57 **-l**, **--latest**=*true*|*false* 58 Show only the latest created container (includes all states). The default is *false*. 59 60 **-n**=*-1* 61 Show n last created containers (includes all states). 62 63 **--no-trunc**=*true*|*false* 64 Don't truncate output. The default is *false*. 65 66 **-q**, **--quiet**=*true*|*false* 67 Only display numeric IDs. The default is *false*. 68 69 **-s**, **--size**=*true*|*false* 70 Display total file sizes. The default is *false*. 71 72 # EXAMPLES 73 # Display all containers, including non-running 74 75 # docker ps -a 76 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 77 a87ecb4f327c fedora:20 /bin/sh -c #(nop) MA 20 minutes ago Exit 0 desperate_brattain 78 01946d9d34d8 vpavlin/rhel7:latest /bin/sh -c #(nop) MA 33 minutes ago Exit 0 thirsty_bell 79 c1d3b0166030 acffc0358b9e /bin/sh -c yum -y up 2 weeks ago Exit 1 determined_torvalds 80 41d50ecd2f57 fedora:20 /bin/sh -c #(nop) MA 2 weeks ago Exit 0 drunk_pike 81 82 # Display only IDs of all containers, including non-running 83 84 # docker ps -a -q 85 a87ecb4f327c 86 01946d9d34d8 87 c1d3b0166030 88 41d50ecd2f57 89 90 # Display only IDs of all containers that have the name `determined_torvalds` 91 92 # docker ps -a -q --filter=name=determined_torvalds 93 c1d3b0166030 94 95 # Display containers with their commands 96 97 # docker ps --format "{{.ID}}: {{.Command}}" 98 a87ecb4f327c: /bin/sh -c #(nop) MA 99 01946d9d34d8: /bin/sh -c #(nop) MA 100 c1d3b0166030: /bin/sh -c yum -y up 101 41d50ecd2f57: /bin/sh -c #(nop) MA 102 103 # Display containers with their labels in a table 104 105 # docker ps --format "table {{.ID}}\t{{.Labels}}" 106 CONTAINER ID LABELS 107 a87ecb4f327c com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd 108 01946d9d34d8 109 c1d3b0166030 com.docker.swarm.node=debian,com.docker.swarm.cpu=6 110 41d50ecd2f57 com.docker.swarm.node=fedora,com.docker.swarm.cpu=3,com.docker.swarm.storage=ssd 111 112 # Display containers with their node label in a table 113 114 # docker ps --format 'table {{.ID}}\t{{(.Label "com.docker.swarm.node")}}' 115 CONTAINER ID NODE 116 a87ecb4f327c ubuntu 117 01946d9d34d8 118 c1d3b0166030 debian 119 41d50ecd2f57 fedora 120 121 # HISTORY 122 April 2014, Originally compiled by William Henry (whenry at redhat dot com) 123 based on docker.com source material and internal work. 124 June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 125 August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 126 November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 127 February 2015, updated by André Martins <martins@noironetworks.com>