docker stack ps [OPTIONS] STACK
Swarm This command works with the Swarm orchestrator.
Lists the tasks that are running as part of the specified stack.
Option Default DescriptionThis is a cluster management command, and must be executed on a swarm manager node. To learn about managers and workers, refer to the Swarm mode section in the documentation.
-f, --filter
Filter output based on conditions provided --format
Format output using a custom template:
--no-resolve
Do not map IDs to Names --no-trunc
Do not truncate output -q, --quiet
Only display task IDs List the tasks that are part of a stack
The following command shows all the tasks that are part of the voting
stack:
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"
). 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.
The currently supported filters are:
idThe id
filter matches on all or a prefix of a task's ID.
The name
filter matches on task names.
The node
filter matches on a node name or a node ID.
The desired-state
filter can take the values running
, shutdown
, ready
or accepted
.
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 stack 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 Name
and Image
entries separated by a colon (:
) for all tasks:
To list all tasks in JSON format, use the json
directive:
The --no-resolve
option shows IDs for task name, without mapping IDs to Names.
When deploying a service, docker resolves the digest for the service's image, and pins the service to that digest. The digest is not shown by default, but is printed if --no-trunc
is used. The --no-trunc
option also shows the non-truncated task IDs, and error-messages, as can be seen below:
The -q
or --quiet
option only shows IDs of the tasks in the stack. This example outputs all task IDs of the voting
stack:
This option can be used to perform batch operations. For example, you can use the task IDs as input for other commands, such as docker inspect
. The following example inspects all tasks of the voting
stack:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4