2016-06-13 22:57:19 -04:00
<!-- [metadata]>
+++
title = "node tasks"
description = "The node tasks command description and usage"
keywords = ["node, tasks"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
# node tasks
2016-07-07 14:43:18 -04:00
```markdown
Usage: docker node tasks [OPTIONS] self|NODE
2016-06-13 22:57:19 -04:00
2016-07-07 14:43:18 -04:00
List tasks running on a node
2016-06-13 22:57:19 -04:00
2016-07-07 14:43:18 -04:00
Options:
-a, --all Display all instances
-f, --filter value Filter output based on conditions provided
2016-06-13 22:57:19 -04:00
--help Print usage
2016-07-13 12:46:17 -04:00
--no-resolve Do not map IDs to Names
2016-07-07 14:43:18 -04:00
```
2016-06-13 22:57:19 -04:00
Lists all the tasks on a Node that Docker knows about. You can filter using the `-f` or `--filter` flag. Refer to the [filtering ](#filtering ) section for more information about available filter options.
Example output:
2016-06-17 00:28:07 -04:00
$ docker node tasks swarm-manager1
ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE
7q92v0nr1hcgts2amcjyqg3pq redis.1 redis redis:3.0.6 Running 5 hours Running swarm-manager1
b465edgho06e318egmgjbqo4o redis.6 redis redis:3.0.6 Running 29 seconds Running swarm-manager1
bg8c07zzg87di2mufeq51a2qp redis.7 redis redis:3.0.6 Running 5 seconds Running swarm-manager1
dkkual96p4bb3s6b10r7coxxt redis.9 redis redis:3.0.6 Running 5 seconds Running swarm-manager1
0tgctg8h8cech4w0k0gwrmr23 redis.10 redis redis:3.0.6 Running 5 seconds Running swarm-manager1
2016-06-13 22:57:19 -04:00
## Filtering
The filtering flag (`-f` or `--filter` ) format is of "key=value". If there is more
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"` )
The currently supported filters are:
2016-06-29 10:16:31 -04:00
* [name ](#name )
* [id ](#id )
* [label ](#label )
2016-06-29 12:20:32 -04:00
* [desired-state ](#desired-state )
2016-06-13 22:57:19 -04:00
2016-06-29 10:16:31 -04:00
#### name
2016-06-13 22:57:19 -04:00
The `name` filter matches on all or part of a task's name.
The following filter matches all tasks with a name containing the `redis` string.
2016-06-17 00:28:07 -04:00
$ docker node tasks -f name=redis swarm-manager1
ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE
7q92v0nr1hcgts2amcjyqg3pq redis.1 redis redis:3.0.6 Running 5 hours Running swarm-manager1
b465edgho06e318egmgjbqo4o redis.6 redis redis:3.0.6 Running 29 seconds Running swarm-manager1
bg8c07zzg87di2mufeq51a2qp redis.7 redis redis:3.0.6 Running 5 seconds Running swarm-manager1
dkkual96p4bb3s6b10r7coxxt redis.9 redis redis:3.0.6 Running 5 seconds Running swarm-manager1
0tgctg8h8cech4w0k0gwrmr23 redis.10 redis redis:3.0.6 Running 5 seconds Running swarm-manager1
2016-06-13 22:57:19 -04:00
2016-06-29 10:16:31 -04:00
#### id
2016-06-13 22:57:19 -04:00
The `id` filter matches a task's id.
2016-06-17 00:28:07 -04:00
$ docker node tasks -f id=bg8c07zzg87di2mufeq51a2qp swarm-manager1
ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE
bg8c07zzg87di2mufeq51a2qp redis.7 redis redis:3.0.6 Running 5 seconds Running swarm-manager1
2016-06-13 22:57:19 -04:00
#### label
The `label` filter matches tasks based on the presence of a `label` alone or a `label` and a
value.
The following filter matches tasks with the `usage` label regardless of its value.
```bash
$ docker node tasks -f "label=usage"
2016-06-17 00:28:07 -04:00
ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE
b465edgho06e318egmgjbqo4o redis.6 redis redis:3.0.6 Running 10 minutes Running swarm-manager1
bg8c07zzg87di2mufeq51a2qp redis.7 redis redis:3.0.6 Running 9 minutes Running swarm-manager1
2016-06-13 22:57:19 -04:00
```
2016-06-29 12:20:32 -04:00
#### desired-state
2016-06-29 10:16:31 -04:00
2016-06-29 12:20:32 -04:00
The `desired-state` filter can take the values `running` and `accepted` .
2016-06-29 10:16:31 -04:00
2016-06-13 22:57:19 -04:00
## Related information
* [node inspect ](node_inspect.md )
* [node update ](node_update.md )
* [node ls ](node_ls.md )
* [node rm ](node_rm.md )