github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/docs/reference/commandline/node_ps.md (about)

     1  ---
     2  title: "node ps"
     3  description: "The node ps command description and usage"
     4  keywords: node, tasks, ps
     5  aliases: ["/engine/reference/commandline/node_tasks/"]
     6  ---
     7  
     8  <!-- This file is maintained within the docker/cli GitHub
     9       repository at https://github.com/docker/cli/. Make all
    10       pull requests against that repo. If you see this file in
    11       another repository, consider it read-only there, as it will
    12       periodically be overwritten by the definitive file. Pull
    13       requests which include edits to this file in other repositories
    14       will be rejected.
    15  -->
    16  
    17  # node ps
    18  
    19  ```markdown
    20  Usage:  docker node ps [OPTIONS] [NODE...]
    21  
    22  List tasks running on one or more nodes, defaults to current node.
    23  
    24  Options:
    25    -f, --filter filter   Filter output based on conditions provided
    26        --format string   Pretty-print tasks using a Go template
    27        --help            Print usage
    28        --no-resolve      Do not map IDs to Names
    29        --no-trunc        Do not truncate output
    30    -q, --quiet           Only display task IDs
    31  ```
    32  
    33  ## Description
    34  
    35  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.
    36  
    37  ## Examples
    38  
    39  ```bash
    40  $ docker node ps swarm-manager1
    41  NAME                                IMAGE        NODE            DESIRED STATE  CURRENT STATE
    42  redis.1.7q92v0nr1hcgts2amcjyqg3pq   redis:3.0.6  swarm-manager1  Running        Running 5 hours
    43  redis.6.b465edgho06e318egmgjbqo4o   redis:3.0.6  swarm-manager1  Running        Running 29 seconds
    44  redis.7.bg8c07zzg87di2mufeq51a2qp   redis:3.0.6  swarm-manager1  Running        Running 5 seconds
    45  redis.9.dkkual96p4bb3s6b10r7coxxt   redis:3.0.6  swarm-manager1  Running        Running 5 seconds
    46  redis.10.0tgctg8h8cech4w0k0gwrmr23  redis:3.0.6  swarm-manager1  Running        Running 5 seconds
    47  ```
    48  
    49  ### Filtering
    50  
    51  The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more
    52  than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
    53  
    54  The currently supported filters are:
    55  
    56  * [name](#name)
    57  * [id](#id)
    58  * [label](#label)
    59  * [desired-state](#desired-state)
    60  
    61  #### name
    62  
    63  The `name` filter matches on all or part of a task's name.
    64  
    65  The following filter matches all tasks with a name containing the `redis` string.
    66  
    67  ```bash
    68  $ docker node ps -f name=redis swarm-manager1
    69  
    70  NAME                                IMAGE        NODE            DESIRED STATE  CURRENT STATE
    71  redis.1.7q92v0nr1hcgts2amcjyqg3pq   redis:3.0.6  swarm-manager1  Running        Running 5 hours
    72  redis.6.b465edgho06e318egmgjbqo4o   redis:3.0.6  swarm-manager1  Running        Running 29 seconds
    73  redis.7.bg8c07zzg87di2mufeq51a2qp   redis:3.0.6  swarm-manager1  Running        Running 5 seconds
    74  redis.9.dkkual96p4bb3s6b10r7coxxt   redis:3.0.6  swarm-manager1  Running        Running 5 seconds
    75  redis.10.0tgctg8h8cech4w0k0gwrmr23  redis:3.0.6  swarm-manager1  Running        Running 5 seconds
    76  ```
    77  
    78  #### id
    79  
    80  The `id` filter matches a task's id.
    81  
    82  ```bash
    83  $ docker node ps -f id=bg8c07zzg87di2mufeq51a2qp swarm-manager1
    84  
    85  NAME                                IMAGE        NODE            DESIRED STATE  CURRENT STATE
    86  redis.7.bg8c07zzg87di2mufeq51a2qp   redis:3.0.6  swarm-manager1  Running        Running 5 seconds
    87  ```
    88  
    89  #### label
    90  
    91  The `label` filter matches tasks based on the presence of a `label` alone or a `label` and a
    92  value.
    93  
    94  The following filter matches tasks with the `usage` label regardless of its value.
    95  
    96  ```bash
    97  $ docker node ps -f "label=usage"
    98  
    99  NAME                               IMAGE        NODE            DESIRED STATE  CURRENT STATE
   100  redis.6.b465edgho06e318egmgjbqo4o  redis:3.0.6  swarm-manager1  Running        Running 10 minutes
   101  redis.7.bg8c07zzg87di2mufeq51a2qp  redis:3.0.6  swarm-manager1  Running        Running 9 minutes
   102  ```
   103  
   104  
   105  #### desired-state
   106  
   107  The `desired-state` filter can take the values `running`, `shutdown`, or `accepted`.
   108  
   109  
   110  ### Formatting
   111  
   112  The formatting options (`--format`) pretty-prints tasks output
   113  using a Go template.
   114  
   115  Valid placeholders for the Go template are listed below:
   116  
   117  Placeholder     | Description
   118  ----------------|------------------------------------------------------------------------------------------
   119  `.Name`         | Task name
   120  `.Image`        | Task image
   121  `.Node`         | Node ID
   122  `.DesiredState` | Desired state of the task (`running`, `shutdown`, or `accepted`)
   123  `.CurrentState` | Current state of the task
   124  `.Error`        | Error
   125  `.Ports`        | Task published ports
   126  
   127  When using the `--format` option, the `node ps` command will either
   128  output the data exactly as the template declares or, when using the
   129  `table` directive, includes column headers as well.
   130  
   131  The following example uses a template without headers and outputs the
   132  `Name` and `Image` entries separated by a colon for all tasks:
   133  
   134  ```bash
   135  $ docker node ps --format "{{.Name}}: {{.Image}}"
   136  top.1: busybox
   137  top.2: busybox
   138  top.3: busybox
   139  ```
   140  
   141  ## Related commands
   142  
   143  * [node demote](node_demote.md)
   144  * [node inspect](node_inspect.md)
   145  * [node ls](node_ls.md)
   146  * [node promote](node_promote.md)
   147  * [node rm](node_rm.md)
   148  * [node update](node_update.md)