docker node ps (original) (raw)
Description | List tasks running on one or more nodes, defaults to current node |
---|---|
Usage | docker node ps [OPTIONS] [NODE...] |
SwarmThis command works with the Swarm orchestrator.
Lists all the tasks on a Node that Docker knows about. You can filter using the-f
or --filter
flag. Refer to thefiltering section for more information about available filter options.
Note
This is a cluster management command, and must be executed on a swarm manager node. To learn about managers and workers, refer to theSwarm mode section in the documentation.
Option | Default | Description |
---|---|---|
-f, --filter | Filter output based on conditions provided | |
--format | Pretty-print tasks using a Go template | |
--no-resolve | Do not map IDs to Names | |
--no-trunc | Do not truncate output | |
-q, --quiet | Only display task IDs |
Filtering (--filter)
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:
name
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.
id
The id
filter matches a task's id.
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.
desired-state
The desired-state
filter can take the values running
, shutdown
, or accepted
.
Format the output (--format)
The formatting options (--format
) pretty-prints tasks output using a Go template.
Valid placeholders for the Go template are listed below:
Placeholder | Description |
---|---|
.ID | Task ID |
.Name | Task name |
.Image | Task image |
.Node | Node ID |
.DesiredState | Desired state of the task (running, shutdown, or accepted) |
.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 thetable
directive, includes column headers as well.
The following example uses a template without headers and outputs theName
and Image
entries separated by a colon (:
) for all tasks: