2016-10-14 18:30:36 -04:00
|
|
|
---
|
|
|
|
title: "service ps"
|
|
|
|
description: "The service ps command description and usage"
|
2016-11-03 18:48:30 -04:00
|
|
|
keywords: "service, tasks, ps"
|
2016-10-14 18:30:36 -04:00
|
|
|
aliases: ["/engine/reference/commandline/service_tasks/"]
|
|
|
|
---
|
2016-06-17 19:51:17 -04:00
|
|
|
|
2016-10-19 13:25:45 -04:00
|
|
|
<!-- This file is maintained within the docker/docker Github
|
|
|
|
repository at https://github.com/docker/docker/. Make all
|
|
|
|
pull requests against that repo. If you see this file in
|
|
|
|
another repository, consider it read-only there, as it will
|
|
|
|
periodically be overwritten by the definitive file. Pull
|
|
|
|
requests which include edits to this file in other repositories
|
|
|
|
will be rejected.
|
|
|
|
-->
|
|
|
|
|
2016-07-19 17:01:31 -04:00
|
|
|
# service ps
|
2016-06-17 19:51:17 -04:00
|
|
|
|
|
|
|
```Markdown
|
2016-10-27 20:02:57 -04:00
|
|
|
Usage: docker service ps [OPTIONS] SERVICE
|
2016-06-17 19:51:17 -04:00
|
|
|
|
|
|
|
List the tasks of a service
|
|
|
|
|
|
|
|
Options:
|
2016-11-03 09:58:45 -04:00
|
|
|
-a, --all Show all tasks (default shows tasks that are or will be running)
|
2016-10-27 20:02:57 -04:00
|
|
|
-f, --filter filter Filter output based on conditions provided
|
|
|
|
--help Print usage
|
|
|
|
--no-resolve Do not map IDs to Names
|
|
|
|
--no-trunc Do not truncate output
|
|
|
|
-q, --quiet Only display task IDs
|
2016-06-17 19:51:17 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
Lists the tasks that are running as part of the specified service. This command
|
|
|
|
has to be run targeting a manager node.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
### Listing the tasks that are part of a service
|
|
|
|
|
|
|
|
The following command shows all the tasks that are part of the `redis` service:
|
|
|
|
|
|
|
|
```bash
|
2016-07-19 17:01:31 -04:00
|
|
|
$ docker service ps redis
|
2016-09-27 22:12:48 -04:00
|
|
|
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
|
|
|
redis.1.0qihejybwf1x5vqi8lgzlgnpq redis:3.0.6 manager1 Running Running 8 seconds
|
|
|
|
redis.2.bk658fpbex0d57cqcwoe3jthu redis:3.0.6 worker2 Running Running 9 seconds
|
|
|
|
redis.3.5ls5s5fldaqg37s9pwayjecrf redis:3.0.6 worker1 Running Running 9 seconds
|
|
|
|
redis.4.8ryt076polmclyihzx67zsssj redis:3.0.6 worker1 Running Running 9 seconds
|
|
|
|
redis.5.1x0v8yomsncd6sbvfn0ph6ogc redis:3.0.6 manager1 Running Running 8 seconds
|
|
|
|
redis.6.71v7je3el7rrw0osfywzs0lko redis:3.0.6 worker2 Running Running 9 seconds
|
|
|
|
redis.7.4l3zm9b7tfr7cedaik8roxq6r redis:3.0.6 worker2 Running Running 9 seconds
|
|
|
|
redis.8.9tfpyixiy2i74ad9uqmzp1q6o redis:3.0.6 worker1 Running Running 9 seconds
|
|
|
|
redis.9.3w1wu13yuplna8ri3fx47iwad redis:3.0.6 manager1 Running Running 8 seconds
|
|
|
|
redis.10.8eaxrb2fqpbnv9x30vr06i6vt redis:3.0.6 manager1 Running Running 8 seconds
|
2016-06-17 19:51:17 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Filtering
|
|
|
|
|
|
|
|
The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there
|
|
|
|
is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`).
|
2016-07-07 14:43:18 -04:00
|
|
|
Multiple filter flags are combined as an `OR` filter. For example,
|
|
|
|
`-f name=redis.1 -f name=redis.7` returns both `redis.1` and `redis.7` tasks.
|
2016-06-17 19:51:17 -04:00
|
|
|
|
|
|
|
The currently supported filters are:
|
|
|
|
|
|
|
|
* [id](#id)
|
|
|
|
* [name](#name)
|
2016-09-29 21:55:52 -04:00
|
|
|
* [node](#node)
|
2016-06-29 12:20:32 -04:00
|
|
|
* [desired-state](#desired-state)
|
2016-06-17 19:51:17 -04:00
|
|
|
|
|
|
|
|
|
|
|
#### ID
|
|
|
|
|
|
|
|
The `id` filter matches on all or a prefix of a task's ID.
|
|
|
|
|
|
|
|
```bash
|
2016-07-19 17:01:31 -04:00
|
|
|
$ docker service ps -f "id=8" redis
|
2016-09-27 22:12:48 -04:00
|
|
|
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
|
|
|
redis.4.8ryt076polmclyihzx67zsssj redis:3.0.6 worker1 Running Running 9 seconds
|
|
|
|
redis.10.8eaxrb2fqpbnv9x30vr06i6vt redis:3.0.6 manager1 Running Running 8 seconds
|
2016-06-17 19:51:17 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Name
|
|
|
|
|
|
|
|
The `name` filter matches on task names.
|
|
|
|
|
|
|
|
```bash
|
2016-07-19 17:01:31 -04:00
|
|
|
$ docker service ps -f "name=redis.1" redis
|
2016-09-27 22:12:48 -04:00
|
|
|
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
|
|
|
redis.1.0qihejybwf1x5vqi8lgzlgnpq redis:3.0.6 manager1 Running Running 8 seconds
|
2016-06-17 19:51:17 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
2016-09-29 21:55:52 -04:00
|
|
|
#### Node
|
|
|
|
|
|
|
|
The `node` filter matches on a node name or a node ID.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker service ps -f "node=manager1" redis
|
|
|
|
NAME IMAGE NODE DESIRED STATE CURRENT STATE
|
|
|
|
redis.1.0qihejybwf1x5vqi8lgzlgnpq redis:3.0.6 manager1 Running Running 8 seconds
|
|
|
|
redis.5.1x0v8yomsncd6sbvfn0ph6ogc redis:3.0.6 manager1 Running Running 8 seconds
|
|
|
|
redis.9.3w1wu13yuplna8ri3fx47iwad redis:3.0.6 manager1 Running Running 8 seconds
|
|
|
|
redis.10.8eaxrb2fqpbnv9x30vr06i6vt redis:3.0.6 manager1 Running Running 8 seconds
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2016-06-29 12:20:32 -04:00
|
|
|
#### desired-state
|
2016-06-29 10:16:31 -04:00
|
|
|
|
2016-07-29 13:46:38 -04:00
|
|
|
The `desired-state` filter can take the values `running`, `shutdown`, and `accepted`.
|
2016-06-29 10:16:31 -04:00
|
|
|
|
|
|
|
|
2016-06-17 19:51:17 -04:00
|
|
|
## Related information
|
|
|
|
|
|
|
|
* [service create](service_create.md)
|
|
|
|
* [service inspect](service_inspect.md)
|
|
|
|
* [service ls](service_ls.md)
|
|
|
|
* [service rm](service_rm.md)
|
|
|
|
* [service scale](service_scale.md)
|
|
|
|
* [service update](service_update.md)
|