github.com/noxiouz/docker@v0.7.3-0.20160629055221-3d231c78e8c5/docs/reference/commandline/service_tasks.md (about) 1 <!--[metadata]> 2 +++ 3 title = "service tasks" 4 description = "The service tasks command description and usage" 5 keywords = ["service, tasks"] 6 advisory = "rc" 7 [menu.main] 8 parent = "smn_cli" 9 +++ 10 <![end-metadata]--> 11 12 # service tasks 13 14 ```Markdown 15 Usage: docker service tasks [OPTIONS] SERVICE 16 17 List the tasks of a service 18 19 Options: 20 -a, --all Display all tasks 21 -f, --filter value Filter output based on conditions provided 22 --help Print usage 23 -n, --no-resolve Do not map IDs to Names 24 ``` 25 26 Lists the tasks that are running as part of the specified service. This command 27 has to be run targeting a manager node. 28 29 30 ## Examples 31 32 ### Listing the tasks that are part of a service 33 34 The following command shows all the tasks that are part of the `redis` service: 35 36 ```bash 37 $ docker service tasks redis 38 ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE 39 0qihejybwf1x5vqi8lgzlgnpq redis.1 redis redis:3.0.6 Running 8 seconds Running manager1 40 bk658fpbex0d57cqcwoe3jthu redis.2 redis redis:3.0.6 Running 9 seconds Running worker2 41 5ls5s5fldaqg37s9pwayjecrf redis.3 redis redis:3.0.6 Running 9 seconds Running worker1 42 8ryt076polmclyihzx67zsssj redis.4 redis redis:3.0.6 Running 9 seconds Running worker1 43 1x0v8yomsncd6sbvfn0ph6ogc redis.5 redis redis:3.0.6 Running 8 seconds Running manager1 44 71v7je3el7rrw0osfywzs0lko redis.6 redis redis:3.0.6 Running 9 seconds Running worker2 45 4l3zm9b7tfr7cedaik8roxq6r redis.7 redis redis:3.0.6 Running 9 seconds Running worker2 46 9tfpyixiy2i74ad9uqmzp1q6o redis.8 redis redis:3.0.6 Running 9 seconds Running worker1 47 3w1wu13yuplna8ri3fx47iwad redis.9 redis redis:3.0.6 Running 8 seconds Running manager1 48 8eaxrb2fqpbnv9x30vr06i6vt redis.10 redis redis:3.0.6 Running 8 seconds Running manager1 49 ``` 50 51 52 ## Filtering 53 54 The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there 55 is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`). 56 Multiple filter flags are combined as an `OR` filter. For example, 57 `-f type=custom -f type=builtin` returns both `custom` and `builtin` networks. 58 59 The currently supported filters are: 60 61 * [id](#id) 62 * [name](#name) 63 64 65 #### ID 66 67 The `id` filter matches on all or a prefix of a task's ID. 68 69 ```bash 70 $ docker service tasks -f "id=8" redis 71 ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE 72 8ryt076polmclyihzx67zsssj redis.4 redis redis:3.0.6 Running 4 minutes Running worker1 73 8eaxrb2fqpbnv9x30vr06i6vt redis.10 redis redis:3.0.6 Running 4 minutes Running manager1 74 ``` 75 76 #### Name 77 78 The `name` filter matches on task names. 79 80 ```bash 81 $ docker service tasks -f "name=redis.1" redis 82 ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE 83 0qihejybwf1x5vqi8lgzlgnpq redis.1 redis redis:3.0.6 Running Running 8 seconds manager1 84 ``` 85 86 87 ## Related information 88 89 * [service create](service_create.md) 90 * [service inspect](service_inspect.md) 91 * [service ls](service_ls.md) 92 * [service rm](service_rm.md) 93 * [service scale](service_scale.md) 94 * [service update](service_update.md)