2016-10-14 22:30:36 +00:00
---
title: "node ps"
description: "The node ps command description and usage"
2016-11-02 21:23:27 +00:00
keywords: node, tasks, ps
2016-10-14 22:30:36 +00:00
aliases: ["/engine/reference/commandline/node_tasks/"]
---
2016-06-14 02:57:19 +00:00
2016-10-19 17:25:45 +00: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 21:01:31 +00:00
# node ps
2016-06-14 02:57:19 +00:00
2016-07-07 18:43:18 +00:00
```markdown
2016-09-04 07:38:50 +00:00
Usage: docker node ps [OPTIONS] [NODE...]
2016-06-14 02:57:19 +00:00
2016-09-04 07:38:50 +00:00
List tasks running on one or more nodes, defaults to current node.
2016-06-14 02:57:19 +00:00
2016-07-07 18:43:18 +00:00
Options:
2016-11-07 05:54:40 +00:00
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print tasks using a Go template
--help Print usage
--no-resolve Do not map IDs to Names
--no-trunc Do not truncate output
-q, --quiet Only display task IDs
2016-07-07 18:43:18 +00:00
```
2016-06-14 02:57:19 +00:00
2017-02-07 23:42:48 +00:00
## Description
2016-06-14 02:57:19 +00:00
2017-02-07 23:42:48 +00: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.
2016-06-14 02:57:19 +00:00
2017-02-07 23:42:48 +00:00
## Examples
2016-06-14 02:57:19 +00:00
2017-02-07 23:42:48 +00:00
```bash
$ docker node ps swarm-manager1
NAME IMAGE NODE DESIRED STATE CURRENT STATE
redis.1.7q92v0nr1hcgts2amcjyqg3pq redis:3.0.6 swarm-manager1 Running Running 5 hours
redis.6.b465edgho06e318egmgjbqo4o redis:3.0.6 swarm-manager1 Running Running 29 seconds
redis.7.bg8c07zzg87di2mufeq51a2qp redis:3.0.6 swarm-manager1 Running Running 5 seconds
redis.9.dkkual96p4bb3s6b10r7coxxt redis:3.0.6 swarm-manager1 Running Running 5 seconds
redis.10.0tgctg8h8cech4w0k0gwrmr23 redis:3.0.6 swarm-manager1 Running Running 5 seconds
```
2016-06-14 02:57:19 +00:00
2017-02-07 23:42:48 +00:00
### Filtering
2016-06-14 02:57:19 +00:00
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 14:16:31 +00:00
* [name ](#name )
* [id ](#id )
* [label ](#label )
2016-06-29 16:20:32 +00:00
* [desired-state ](#desired-state )
2016-06-14 02:57:19 +00:00
2016-06-29 14:16:31 +00:00
#### name
2016-06-14 02:57:19 +00: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.
2017-02-07 23:42:48 +00:00
```bash
$ docker node ps -f name=redis swarm-manager1
NAME IMAGE NODE DESIRED STATE CURRENT STATE
redis.1.7q92v0nr1hcgts2amcjyqg3pq redis:3.0.6 swarm-manager1 Running Running 5 hours
redis.6.b465edgho06e318egmgjbqo4o redis:3.0.6 swarm-manager1 Running Running 29 seconds
redis.7.bg8c07zzg87di2mufeq51a2qp redis:3.0.6 swarm-manager1 Running Running 5 seconds
redis.9.dkkual96p4bb3s6b10r7coxxt redis:3.0.6 swarm-manager1 Running Running 5 seconds
redis.10.0tgctg8h8cech4w0k0gwrmr23 redis:3.0.6 swarm-manager1 Running Running 5 seconds
```
2016-06-14 02:57:19 +00:00
2016-06-29 14:16:31 +00:00
#### id
2016-06-14 02:57:19 +00:00
The `id` filter matches a task's id.
2017-02-07 23:42:48 +00:00
```bash
$ docker node ps -f id=bg8c07zzg87di2mufeq51a2qp swarm-manager1
2016-06-14 02:57:19 +00:00
2017-02-07 23:42:48 +00:00
NAME IMAGE NODE DESIRED STATE CURRENT STATE
redis.7.bg8c07zzg87di2mufeq51a2qp redis:3.0.6 swarm-manager1 Running Running 5 seconds
```
2016-06-14 02:57:19 +00: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
2016-07-19 21:01:31 +00:00
$ docker node ps -f "label=usage"
2017-02-07 23:42:48 +00:00
2016-09-28 02:12:48 +00:00
NAME IMAGE NODE DESIRED STATE CURRENT STATE
redis.6.b465edgho06e318egmgjbqo4o redis:3.0.6 swarm-manager1 Running Running 10 minutes
redis.7.bg8c07zzg87di2mufeq51a2qp redis:3.0.6 swarm-manager1 Running Running 9 minutes
2016-06-14 02:57:19 +00:00
```
2016-06-29 16:20:32 +00:00
#### desired-state
2016-06-29 14:16:31 +00:00
2017-03-29 20:13:28 +00:00
The `desired-state` filter can take the values `running` , `shutdown` , or `accepted` .
2016-06-29 14:16:31 +00:00
2016-11-07 05:54:40 +00:00
### Formatting
The formatting options (`--format`) pretty-prints tasks output
using a Go template.
Valid placeholders for the Go template are listed below:
Placeholder | Description
----------------|------------------------------------------------------------------------------------------
`.Name` | Task name
`.Image` | Task image
`.Node` | Node ID
2017-03-29 20:13:28 +00:00
`.DesiredState` | Desired state of the task (`running`, `shutdown` , or `accepted` )
2016-11-07 05:54:40 +00:00
`.CurrentState` | Current state of the task
`.Error` | Error
`.Ports` | Task published ports
When using the `--format` option, the `node ps` command will either
output the data exactly as the template declares or, when using the
`table` directive, includes column headers as well.
The following example uses a template without headers and outputs the
2017-03-29 20:13:28 +00:00
`Name` and `Image` entries separated by a colon for all tasks:
2016-11-07 05:54:40 +00:00
```bash
$ docker node ps --format "{{.Name}}: {{.Image}}"
top.1: busybox
top.2: busybox
top.3: busybox
```
2017-02-07 23:42:48 +00:00
## Related commands
2016-06-14 02:57:19 +00:00
2016-12-13 14:15:08 +00:00
* [node demote ](node_demote.md )
2016-06-14 02:57:19 +00:00
* [node inspect ](node_inspect.md )
* [node ls ](node_ls.md )
2016-12-13 14:15:08 +00:00
* [node promote ](node_promote.md )
2016-06-14 02:57:19 +00:00
* [node rm ](node_rm.md )
2016-12-13 14:15:08 +00:00
* [node update ](node_update.md )