The following Docker command line is used to filter and display information in a more concise and screen-friendly format. It selectively filters only the services and/or containers currently active with a “running” status on specific Docker nodes.
docker node ps --filter "desired-state=running" --format "table {{.ID}}\\t{{.Name}}\\t{{.Image}}\\t{{.Node}}\\t{{.CurrentState}}\\t{{.Error}}" node1 node2 node3
Here is a detailed explanation of what the command does::
- Using
, to retrieve information about services running on Docker nodes.docker node ps - By utilizing the
flag, it ensures that only services with the desired “running” status are displayed.--filter "desired-state=running" - Define how the output will appear with
--format "table {{.ID}}\\t{{.Name}}\\t{{.Image}}\\t{{.Node}}\\t{{.CurrentState}}\\t{{.Error}}"
It will present the information in a tabulated format, featuring distinct fields:: Represents the unique identifier of each service.{{.ID}}: Displays the name of each service.{{.Name}}: Docker image name utilized by each service.{{.Image}}: Name of the Docker node on which each service is running.{{.Node}}: Indication whether it is currently in the “running” state..{{.CurrentState}}: In the presence of service-related issues, display corresponding error messages.{{.Error}}- (!) Note the double-escaped tab
\\t
- Concluding with
, I specify to exclusively acquire information about services running on the designated nodes named node1, node2, and node3.node1 node2 node3
Below is an illustration of how this output appears.

In summary, this can be used to effectively filter active services on the provided nodes and present them in a tabular format, highlighting critical details such as service ID, name, Docker image, node association, status, and any potential error messages.