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