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