Add hidden placeholder of .Self
for docker node ls --format
This commit adds a hidden placeholder of `.Self` for `docker node ls --format` so that if the node is the same as the current docker daemon, then a `*` is outputed. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
477ec9bfdd
commit
45f80dccb0
@ -169,8 +169,8 @@ format. For a list of supported formatting directives, see
|
|||||||
|
|
||||||
The property `nodesFormat` specifies the default format for `docker node ls` output.
|
The property `nodesFormat` specifies the default format for `docker node ls` output.
|
||||||
When the `--format` flag is not provided with the `docker node ls` command,
|
When the `--format` flag is not provided with the `docker node ls` command,
|
||||||
Docker's client uses this property. If this property is not set, the client
|
Docker's client uses the value of `nodesFormat`. If the value of `nodesFormat` is not set,
|
||||||
falls back to the default table format. For a list of supported formatting
|
the client uses the default table format. For a list of supported formatting
|
||||||
directives, see the [**Formatting** section in the `docker node ls` documentation](node_ls.md)
|
directives, see the [**Formatting** section in the `docker node ls` documentation](node_ls.md)
|
||||||
|
|
||||||
The property `credsStore` specifies an external binary to serve as the default
|
The property `credsStore` specifies an external binary to serve as the default
|
||||||
|
@ -46,9 +46,10 @@ ID HOSTNAME STATUS AVAILABILITY MANAGER STATU
|
|||||||
38ciaotwjuritcdtn9npbnkuz swarm-worker1 Ready Active
|
38ciaotwjuritcdtn9npbnkuz swarm-worker1 Ready Active
|
||||||
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
|
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
|
||||||
```
|
```
|
||||||
> **Note:**
|
> **Note**:
|
||||||
> If the `ID` field of the node is followed by a `*` (e.g., `e216jshn25ckzbvmwlnh5jr3g *`)
|
> In the above example output, there is a hidden column of `.Self` that indicates if the
|
||||||
> in the above example output, then this node is also the node of the current docker daemon.
|
> node is the same node as the current docker daemon. A `*` (e.g., `e216jshn25ckzbvmwlnh5jr3g *`)
|
||||||
|
> means this node is the current docker daemon.
|
||||||
|
|
||||||
|
|
||||||
### Filtering
|
### Filtering
|
||||||
@ -139,6 +140,7 @@ Valid placeholders for the Go template are listed below:
|
|||||||
Placeholder | Description
|
Placeholder | Description
|
||||||
-----------------|------------------------------------------------------------------------------------------
|
-----------------|------------------------------------------------------------------------------------------
|
||||||
`.ID` | Node ID
|
`.ID` | Node ID
|
||||||
|
`.Self` | Node of the daemon (`true/false`, `true`indicates that the node is the same as current docker daemon)
|
||||||
`.Hostname` | Node hostname
|
`.Hostname` | Node hostname
|
||||||
`.Status` | Node status
|
`.Status` | Node status
|
||||||
`.Availability` | Node availability ("active", "pause", or "drain")
|
`.Availability` | Node availability ("active", "pause", or "drain")
|
||||||
@ -153,7 +155,7 @@ The following example uses a template without headers and outputs the
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker node ls --format "{{.ID}}: {{.Hostname}}"
|
$ docker node ls --format "{{.ID}}: {{.Hostname}}"
|
||||||
e216jshn25ckzbvmwlnh5jr3g *: swarm-manager1
|
e216jshn25ckzbvmwlnh5jr3g: swarm-manager1
|
||||||
``
|
``
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user