github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/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 Lists all the nodes that the Docker Swarm manager knows about. You can filter using the `-f` or `--filter` flag. Refer to the [filtering](#filtering) section for more information about available filter options. 33 34 Example output: 35 36 ```bash 37 $ docker node ls 38 39 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 40 1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active 41 38ciaotwjuritcdtn9npbnkuz swarm-worker1 Ready Active 42 e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader 43 ``` 44 45 ## Filtering 46 47 The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more 48 than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`) 49 50 The currently supported filters are: 51 52 * [id](node_ls.md#id) 53 * [label](node_ls.md#label) 54 * [membership](node_ls.md#membership) 55 * [name](node_ls.md#name) 56 * [role](node_ls.md#role) 57 58 #### ID 59 60 The `id` filter matches all or part of a node's id. 61 62 ```bash 63 $ docker node ls -f id=1 64 65 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 66 1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active 67 ``` 68 69 #### Label 70 71 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. 72 73 The following filter matches nodes with the `foo` label regardless of its value. 74 75 ```bash 76 $ docker node ls -f "label=foo" 77 78 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 79 1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active 80 ``` 81 82 #### Membership 83 84 The `membership` filter matches nodes based on the presence of a `membership` and a value 85 `accepted` or `pending`. 86 87 The following filter matches nodes with the `membership` of `accepted`. 88 89 ```bash 90 $ docker node ls -f "membership=accepted" 91 92 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 93 1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active 94 38ciaotwjuritcdtn9npbnkuz swarm-worker1 Ready Active 95 ``` 96 97 #### Name 98 99 The `name` filter matches on all or part of a node hostname. 100 101 The following filter matches the nodes with a name equal to `swarm-master` string. 102 103 ```bash 104 $ docker node ls -f name=swarm-manager1 105 106 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 107 e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader 108 ``` 109 110 #### Role 111 112 The `role` filter matches nodes based on the presence of a `role` and a value `worker` or `manager`. 113 114 The following filter matches nodes with the `manager` role. 115 116 ```bash 117 $ docker node ls -f "role=manager" 118 119 ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 120 e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader 121 ``` 122 123 ## Related information 124 125 * [node demote](node_demote.md) 126 * [node inspect](node_inspect.md) 127 * [node promote](node_promote.md) 128 * [node ps](node_ps.md) 129 * [node rm](node_rm.md) 130 * [node update](node_update.md)