github.com/chenchun/docker@v1.3.2-0.20150629222414-20467faf132b/docs/reference/commandline/ps.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "ps"
     4  description = "The ps command description and usage"
     5  keywords = ["container, running, list"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  weight=1
     9  +++
    10  <![end-metadata]-->
    11  
    12  # ps
    13  
    14      Usage: docker ps [OPTIONS]
    15  
    16      List containers
    17  
    18        -a, --all=false       Show all containers (default shows just running)
    19        --before=""           Show only container created before Id or Name
    20        -f, --filter=[]       Filter output based on conditions provided
    21        -l, --latest=false    Show the latest created container, include non-running
    22        -n=-1                 Show n last created containers, include non-running
    23        --no-trunc=false      Don't truncate output
    24        -q, --quiet=false     Only display numeric IDs
    25        -s, --size=false      Display total file sizes
    26        --since=""            Show created since Id or Name, include non-running
    27  
    28  Running `docker ps --no-trunc` showing 2 linked containers.
    29  
    30      $ docker ps
    31      CONTAINER ID        IMAGE                        COMMAND                CREATED              STATUS              PORTS               NAMES
    32      4c01db0b339c        ubuntu:12.04                 bash                   17 seconds ago       Up 16 seconds       3300-3310/tcp       webapp
    33      d7886598dbe2        crosbymichael/redis:latest   /redis-server --dir    33 minutes ago       Up 33 minutes       6379/tcp            redis,webapp/db
    34  
    35  `docker ps` will show only running containers by default. To see all containers:
    36  `docker ps -a`
    37  
    38  `docker ps` will group exposed ports into a single range if possible. E.g., a container that exposes TCP ports `100, 101, 102` will display `100-102/tcp` in the `PORTS` column.
    39  
    40  ## Filtering
    41  
    42  The filtering flag (`-f` or `--filter)` format is a `key=value` pair. If there is more
    43  than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`)
    44  
    45  The currently supported filters are:
    46  
    47  * id (container's id)
    48  * label (`label=<key>` or `label=<key>=<value>`)
    49  * name (container's name)
    50  * exited (int - the code of exited containers. Only useful with `--all`)
    51  * status (created|restarting|running|paused|exited)
    52  
    53  ## Successfully exited containers
    54  
    55      $ docker ps -a --filter 'exited=0'
    56      CONTAINER ID        IMAGE             COMMAND                CREATED             STATUS                   PORTS                      NAMES
    57      ea09c3c82f6e        registry:latest   /srv/run.sh            2 weeks ago         Exited (0) 2 weeks ago   127.0.0.1:5000->5000/tcp   desperate_leakey
    58      106ea823fe4e        fedora:latest     /bin/sh -c 'bash -l'   2 weeks ago         Exited (0) 2 weeks ago                              determined_albattani
    59      48ee228c9464        fedora:20         bash                   2 weeks ago         Exited (0) 2 weeks ago                              tender_torvalds
    60  
    61  This shows all the containers that have exited with status of '0'
    62  
    63  
    64