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