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