github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/docs/reference/commandline/service_ps.md (about)

     1  ---
     2  title: "service ps"
     3  description: "The service ps command description and usage"
     4  keywords: ["service, tasks", "ps"]
     5  aliases: ["/engine/reference/commandline/service_tasks/"]
     6  ---
     7  
     8  <!-- This file is maintained within the docker/docker Github
     9       repository at https://github.com/docker/docker/. Make all
    10       pull requests against that repo. If you see this file in
    11       another repository, consider it read-only there, as it will
    12       periodically be overwritten by the definitive file. Pull
    13       requests which include edits to this file in other repositories
    14       will be rejected.
    15  -->
    16  
    17  # service ps
    18  
    19  ```Markdown
    20  Usage:  docker service ps [OPTIONS] SERVICE
    21  
    22  List the tasks of a service
    23  
    24  Options:
    25    -f, --filter filter   Filter output based on conditions provided
    26        --help            Print usage
    27        --no-resolve      Do not map IDs to Names
    28        --no-trunc        Do not truncate output
    29    -q, --quiet           Only display task IDs
    30  ```
    31  
    32  Lists the tasks that are running as part of the specified service. This command
    33  has to be run targeting a manager node.
    34  
    35  ## Examples
    36  
    37  ### Listing the tasks that are part of a service
    38  
    39  The following command shows all the tasks that are part of the `redis` service:
    40  
    41  ```bash
    42  $ docker service ps redis
    43  NAME                                IMAGE        NODE      DESIRED STATE  CURRENT STATE
    44  redis.1.0qihejybwf1x5vqi8lgzlgnpq   redis:3.0.6  manager1  Running        Running 8 seconds
    45  redis.2.bk658fpbex0d57cqcwoe3jthu   redis:3.0.6  worker2   Running        Running 9 seconds
    46  redis.3.5ls5s5fldaqg37s9pwayjecrf   redis:3.0.6  worker1   Running        Running 9 seconds
    47  redis.4.8ryt076polmclyihzx67zsssj   redis:3.0.6  worker1   Running        Running 9 seconds
    48  redis.5.1x0v8yomsncd6sbvfn0ph6ogc   redis:3.0.6  manager1  Running        Running 8 seconds
    49  redis.6.71v7je3el7rrw0osfywzs0lko   redis:3.0.6  worker2   Running        Running 9 seconds
    50  redis.7.4l3zm9b7tfr7cedaik8roxq6r   redis:3.0.6  worker2   Running        Running 9 seconds
    51  redis.8.9tfpyixiy2i74ad9uqmzp1q6o   redis:3.0.6  worker1   Running        Running 9 seconds
    52  redis.9.3w1wu13yuplna8ri3fx47iwad   redis:3.0.6  manager1  Running        Running 8 seconds
    53  redis.10.8eaxrb2fqpbnv9x30vr06i6vt  redis:3.0.6  manager1  Running        Running 8 seconds
    54  ```
    55  
    56  
    57  ## Filtering
    58  
    59  The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there
    60  is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`).
    61  Multiple filter flags are combined as an `OR` filter. For example,
    62  `-f name=redis.1 -f name=redis.7` returns both `redis.1` and `redis.7` tasks.
    63  
    64  The currently supported filters are:
    65  
    66  * [id](#id)
    67  * [name](#name)
    68  * [node](#node)
    69  * [desired-state](#desired-state)
    70  
    71  
    72  #### ID
    73  
    74  The `id` filter matches on all or a prefix of a task's ID.
    75  
    76  ```bash
    77  $ docker service ps -f "id=8" redis
    78  NAME                                IMAGE        NODE      DESIRED STATE  CURRENT STATE
    79  redis.4.8ryt076polmclyihzx67zsssj   redis:3.0.6  worker1   Running        Running 9 seconds
    80  redis.10.8eaxrb2fqpbnv9x30vr06i6vt  redis:3.0.6  manager1  Running        Running 8 seconds
    81  ```
    82  
    83  #### Name
    84  
    85  The `name` filter matches on task names.
    86  
    87  ```bash
    88  $ docker service ps -f "name=redis.1" redis
    89  NAME                                IMAGE        NODE      DESIRED STATE  CURRENT STATE
    90  redis.1.0qihejybwf1x5vqi8lgzlgnpq   redis:3.0.6  manager1  Running        Running 8 seconds
    91  ```
    92  
    93  
    94  #### Node
    95  
    96  The `node` filter matches on a node name or a node ID.
    97  
    98  ```bash
    99  $ docker service ps -f "node=manager1" redis
   100  NAME                                IMAGE        NODE      DESIRED STATE  CURRENT STATE
   101  redis.1.0qihejybwf1x5vqi8lgzlgnpq   redis:3.0.6  manager1  Running        Running 8 seconds
   102  redis.5.1x0v8yomsncd6sbvfn0ph6ogc   redis:3.0.6  manager1  Running        Running 8 seconds
   103  redis.9.3w1wu13yuplna8ri3fx47iwad   redis:3.0.6  manager1  Running        Running 8 seconds
   104  redis.10.8eaxrb2fqpbnv9x30vr06i6vt  redis:3.0.6  manager1  Running        Running 8 seconds
   105  ```
   106  
   107  
   108  #### desired-state
   109  
   110  The `desired-state` filter can take the values `running`, `shutdown`, and `accepted`.
   111  
   112  
   113  ## Related information
   114  
   115  * [service create](service_create.md)
   116  * [service inspect](service_inspect.md)
   117  * [service ls](service_ls.md)
   118  * [service rm](service_rm.md)
   119  * [service scale](service_scale.md)
   120  * [service update](service_update.md)