github.com/endophage/docker@v1.4.2-0.20161027011718-242853499895/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    -a, --all            Display all tasks
    26    -f, --filter value   Filter output based on conditions provided
    27        --help           Print usage
    28        --no-resolve     Do not map IDs to Names
    29        --no-trunc       Do not truncate output
    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  
    36  ## Examples
    37  
    38  ### Listing the tasks that are part of a service
    39  
    40  The following command shows all the tasks that are part of the `redis` service:
    41  
    42  ```bash
    43  $ docker service ps redis
    44  NAME                                IMAGE        NODE      DESIRED STATE  CURRENT STATE
    45  redis.1.0qihejybwf1x5vqi8lgzlgnpq   redis:3.0.6  manager1  Running        Running 8 seconds
    46  redis.2.bk658fpbex0d57cqcwoe3jthu   redis:3.0.6  worker2   Running        Running 9 seconds
    47  redis.3.5ls5s5fldaqg37s9pwayjecrf   redis:3.0.6  worker1   Running        Running 9 seconds
    48  redis.4.8ryt076polmclyihzx67zsssj   redis:3.0.6  worker1   Running        Running 9 seconds
    49  redis.5.1x0v8yomsncd6sbvfn0ph6ogc   redis:3.0.6  manager1  Running        Running 8 seconds
    50  redis.6.71v7je3el7rrw0osfywzs0lko   redis:3.0.6  worker2   Running        Running 9 seconds
    51  redis.7.4l3zm9b7tfr7cedaik8roxq6r   redis:3.0.6  worker2   Running        Running 9 seconds
    52  redis.8.9tfpyixiy2i74ad9uqmzp1q6o   redis:3.0.6  worker1   Running        Running 9 seconds
    53  redis.9.3w1wu13yuplna8ri3fx47iwad   redis:3.0.6  manager1  Running        Running 8 seconds
    54  redis.10.8eaxrb2fqpbnv9x30vr06i6vt  redis:3.0.6  manager1  Running        Running 8 seconds
    55  ```
    56  
    57  
    58  ## Filtering
    59  
    60  The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there
    61  is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`).
    62  Multiple filter flags are combined as an `OR` filter. For example,
    63  `-f name=redis.1 -f name=redis.7` returns both `redis.1` and `redis.7` tasks.
    64  
    65  The currently supported filters are:
    66  
    67  * [id](#id)
    68  * [name](#name)
    69  * [node](#node)
    70  * [desired-state](#desired-state)
    71  
    72  
    73  #### ID
    74  
    75  The `id` filter matches on all or a prefix of a task's ID.
    76  
    77  ```bash
    78  $ docker service ps -f "id=8" redis
    79  NAME                                IMAGE        NODE      DESIRED STATE  CURRENT STATE
    80  redis.4.8ryt076polmclyihzx67zsssj   redis:3.0.6  worker1   Running        Running 9 seconds
    81  redis.10.8eaxrb2fqpbnv9x30vr06i6vt  redis:3.0.6  manager1  Running        Running 8 seconds
    82  ```
    83  
    84  #### Name
    85  
    86  The `name` filter matches on task names.
    87  
    88  ```bash
    89  $ docker service ps -f "name=redis.1" redis
    90  NAME                                IMAGE        NODE      DESIRED STATE  CURRENT STATE
    91  redis.1.0qihejybwf1x5vqi8lgzlgnpq   redis:3.0.6  manager1  Running        Running 8 seconds
    92  ```
    93  
    94  
    95  #### Node
    96  
    97  The `node` filter matches on a node name or a node ID.
    98  
    99  ```bash
   100  $ docker service ps -f "node=manager1" redis
   101  NAME                                IMAGE        NODE      DESIRED STATE  CURRENT STATE
   102  redis.1.0qihejybwf1x5vqi8lgzlgnpq   redis:3.0.6  manager1  Running        Running 8 seconds
   103  redis.5.1x0v8yomsncd6sbvfn0ph6ogc   redis:3.0.6  manager1  Running        Running 8 seconds
   104  redis.9.3w1wu13yuplna8ri3fx47iwad   redis:3.0.6  manager1  Running        Running 8 seconds
   105  redis.10.8eaxrb2fqpbnv9x30vr06i6vt  redis:3.0.6  manager1  Running        Running 8 seconds
   106  ```
   107  
   108  
   109  #### desired-state
   110  
   111  The `desired-state` filter can take the values `running`, `shutdown`, and `accepted`.
   112  
   113  
   114  ## Related information
   115  
   116  * [service create](service_create.md)
   117  * [service inspect](service_inspect.md)
   118  * [service ls](service_ls.md)
   119  * [service rm](service_rm.md)
   120  * [service scale](service_scale.md)
   121  * [service update](service_update.md)