github.com/uppal0016/docker_new@v0.0.0-20240123060250-1c98be13ac2c/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 - volume=(<volume-name>|<mount-point-destination>) 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 .Names - Container names. 52 .Labels - All labels assigned to the container. 53 .Label - Value of a specific label for this container. For example `{{.Label "com.docker.swarm.cpu"}}` 54 .Mounts - Names of the volumes mounted in this container. 55 56 **--help** 57 Print usage statement 58 59 **-l**, **--latest**=*true*|*false* 60 Show only the latest created container (includes all states). The default is *false*. 61 62 **-n**=*-1* 63 Show n last created containers (includes all states). 64 65 **--no-trunc**=*true*|*false* 66 Don't truncate output. The default is *false*. 67 68 **-q**, **--quiet**=*true*|*false* 69 Only display numeric IDs. The default is *false*. 70 71 **-s**, **--size**=*true*|*false* 72 Display total file sizes. The default is *false*. 73 74 # EXAMPLES 75 # Display all containers, including non-running 76 77 # docker ps -a 78 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 79 a87ecb4f327c fedora:20 /bin/sh -c #(nop) MA 20 minutes ago Exit 0 desperate_brattain 80 01946d9d34d8 vpavlin/rhel7:latest /bin/sh -c #(nop) MA 33 minutes ago Exit 0 thirsty_bell 81 c1d3b0166030 acffc0358b9e /bin/sh -c yum -y up 2 weeks ago Exit 1 determined_torvalds 82 41d50ecd2f57 fedora:20 /bin/sh -c #(nop) MA 2 weeks ago Exit 0 drunk_pike 83 84 # Display only IDs of all containers, including non-running 85 86 # docker ps -a -q 87 a87ecb4f327c 88 01946d9d34d8 89 c1d3b0166030 90 41d50ecd2f57 91 92 # Display only IDs of all containers that have the name `determined_torvalds` 93 94 # docker ps -a -q --filter=name=determined_torvalds 95 c1d3b0166030 96 97 # Display containers with their commands 98 99 # docker ps --format "{{.ID}}: {{.Command}}" 100 a87ecb4f327c: /bin/sh -c #(nop) MA 101 01946d9d34d8: /bin/sh -c #(nop) MA 102 c1d3b0166030: /bin/sh -c yum -y up 103 41d50ecd2f57: /bin/sh -c #(nop) MA 104 105 # Display containers with their labels in a table 106 107 # docker ps --format "table {{.ID}}\t{{.Labels}}" 108 CONTAINER ID LABELS 109 a87ecb4f327c com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd 110 01946d9d34d8 111 c1d3b0166030 com.docker.swarm.node=debian,com.docker.swarm.cpu=6 112 41d50ecd2f57 com.docker.swarm.node=fedora,com.docker.swarm.cpu=3,com.docker.swarm.storage=ssd 113 114 # Display containers with their node label in a table 115 116 # docker ps --format 'table {{.ID}}\t{{(.Label "com.docker.swarm.node")}}' 117 CONTAINER ID NODE 118 a87ecb4f327c ubuntu 119 01946d9d34d8 120 c1d3b0166030 debian 121 41d50ecd2f57 fedora 122 123 # Display containers with `remote-volume` mounted 124 125 $ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}" 126 CONTAINER ID MOUNTS 127 9c3527ed70ce remote-volume 128 129 # Display containers with a volume mounted in `/data` 130 131 $ docker ps --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}" 132 CONTAINER ID MOUNTS 133 9c3527ed70ce remote-volume 134 135 # HISTORY 136 April 2014, Originally compiled by William Henry (whenry at redhat dot com) 137 based on docker.com source material and internal work. 138 June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 139 August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 140 November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 141 February 2015, updated by André Martins <martins@noironetworks.com>