github.com/yogeshlonkar/moby@v1.13.2-0.20201203103638-c0b64beaea94/docs/reference/commandline/node_ls.md (about)

     1  ---
     2  title: "node ls"
     3  description: "The node ls command description and usage"
     4  keywords: "node, list"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # node ls
    17  
    18  ```markdown
    19  Usage:  docker node ls [OPTIONS]
    20  
    21  List nodes in the swarm
    22  
    23  Aliases:
    24    ls, list
    25  
    26  Options:
    27    -f, --filter value   Filter output based on conditions provided
    28        --help           Print usage
    29    -q, --quiet          Only display IDs
    30  ```
    31  
    32  ## Description
    33  
    34  Lists all the nodes that the Docker Swarm manager knows about. You can filter
    35  using the `-f` or `--filter` flag. Refer to the [filtering](#filtering) section
    36  for more information about available filter options.
    37  
    38  ## Examples
    39  
    40  ```bash
    41  $ docker node ls
    42  
    43  ID                           HOSTNAME        STATUS  AVAILABILITY  MANAGER STATUS
    44  1bcef6utixb0l0ca7gxuivsj0    swarm-worker2   Ready   Active
    45  38ciaotwjuritcdtn9npbnkuz    swarm-worker1   Ready   Active
    46  e216jshn25ckzbvmwlnh5jr3g *  swarm-manager1  Ready   Active        Leader
    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  * [id](node_ls.md#id)
    57  * [label](node_ls.md#label)
    58  * [membership](node_ls.md#membership)
    59  * [name](node_ls.md#name)
    60  * [role](node_ls.md#role)
    61  
    62  #### id
    63  
    64  The `id` filter matches all or part of a node's id.
    65  
    66  ```bash
    67  $ docker node ls -f id=1
    68  
    69  ID                         HOSTNAME       STATUS  AVAILABILITY  MANAGER STATUS
    70  1bcef6utixb0l0ca7gxuivsj0  swarm-worker2  Ready   Active
    71  ```
    72  
    73  #### label
    74  
    75  The `label` filter matches nodes based on engine labels and on the presence of a `label` alone or a `label` and a value. Node labels are currently not used for filtering.
    76  
    77  The following filter matches nodes with the `foo` label regardless of its value.
    78  
    79  ```bash
    80  $ docker node ls -f "label=foo"
    81  
    82  ID                         HOSTNAME       STATUS  AVAILABILITY  MANAGER STATUS
    83  1bcef6utixb0l0ca7gxuivsj0  swarm-worker2  Ready   Active
    84  ```
    85  
    86  #### membership
    87  
    88  The `membership` filter matches nodes based on the presence of a `membership` and a value
    89  `accepted` or `pending`.
    90  
    91  The following filter matches nodes with the `membership` of `accepted`.
    92  
    93  ```bash
    94  $ docker node ls -f "membership=accepted"
    95  
    96  ID                           HOSTNAME        STATUS  AVAILABILITY  MANAGER STATUS
    97  1bcef6utixb0l0ca7gxuivsj0    swarm-worker2   Ready   Active
    98  38ciaotwjuritcdtn9npbnkuz    swarm-worker1   Ready   Active
    99  ```
   100  
   101  #### name
   102  
   103  The `name` filter matches on all or part of a node hostname.
   104  
   105  The following filter matches the nodes with a name equal to `swarm-master` string.
   106  
   107  ```bash
   108  $ docker node ls -f name=swarm-manager1
   109  
   110  ID                           HOSTNAME        STATUS  AVAILABILITY  MANAGER STATUS
   111  e216jshn25ckzbvmwlnh5jr3g *  swarm-manager1  Ready   Active        Leader
   112  ```
   113  
   114  #### role
   115  
   116  The `role` filter matches nodes based on the presence of a `role` and a value `worker` or `manager`.
   117  
   118  The following filter matches nodes with the `manager` role.
   119  
   120  ```bash
   121  $ docker node ls -f "role=manager"
   122  
   123  ID                           HOSTNAME        STATUS  AVAILABILITY  MANAGER STATUS
   124  e216jshn25ckzbvmwlnh5jr3g *  swarm-manager1  Ready   Active        Leader
   125  ```
   126  
   127  ## Related commands
   128  
   129  * [node demote](node_demote.md)
   130  * [node inspect](node_inspect.md)
   131  * [node promote](node_promote.md)
   132  * [node ps](node_ps.md)
   133  * [node rm](node_rm.md)
   134  * [node update](node_update.md)