diff --git a/DockerSwarm/Creaate-Swarm.adoc b/DockerSwarm/Creaate-Swarm.adoc index 03d1a9d..881d9fc 100644 --- a/DockerSwarm/Creaate-Swarm.adoc +++ b/DockerSwarm/Creaate-Swarm.adoc @@ -156,6 +156,7 @@ You can use the *--force* option on a manager to remove it from the swarm. ==== The safe way to remove a manager from a swarm is to *demote* it to a worker and then direct it to leave the quorum without using --force + ---- docker node demote id ---- @@ -167,14 +168,79 @@ docker node demote id == Manage nodes -- *docker node demote* Demote one or more nodes from manager in the swarm -- *docker node inspect* Display detailed information on one or more nodes - *docker node ls* List nodes in the swarm -- *docker node promote* Promote one or more nodes to manager in the swarm -- *docker node ps* List tasks running on one or more nodes, defaults to current node -- *docker node rm* Remove one or more nodes from the swarm -- *docker node update* Update a node +---- +docker node ls +---- + +- *docker node demote* `_ Demote one or more nodes from manager in the swarm_` +- *docker node inspect* `_ Display detailed information on one or more nodes_` +- *docker node promote* `_ Promote one or more nodes to manager in the swarm_~ +- *docker node ps* `_ List tasks running on one or more nodes, defaults to current node_` +- *docker node rm* `_ Remove one or more nodes from the swarm_~ +- *docker node update* `_ Update a node_` +- *docker node inspect* `_ Display detailed information on one or more nodes_` + +---- +docker node inspect id # from ls +---- + +---- +[ + { + "ID": "e216jshn25ckzbvmwlnh5jr3g", + "Version": { + "Index": 10 + }, + "CreatedAt": "2017-05-16T22:52:44.9910662Z", + "UpdatedAt": "2017-05-16T22:52:45.230878043Z", + "Spec": { + "Role": "manager", + "Availability": "active" + }, + "Description": { + "Hostname": "swarm-manager", + "Platform": { + "Architecture": "x86_64", + "OS": "linux" + }, + "Resources": { + "NanoCPUs": 1000000000, + "MemoryBytes": 1039843328 + }, + "Engine": { + "EngineVersion": "17.06.0-ce", + "Plugins": [ + { + "Type": "Volume", + }, + "Status": { + "State": "ready", + "Addr": "168.0.32.137" + }, + "ManagerStatus": { + "Leader": true, + "Reachability": "reachable", + "Addr": "168.0.32.137:2377" + } + } +] +---- +[NOTE] +.INFO +==== + +Filtering output with jq + +.jq +[source,sh] +---- +apt update +apt install jq +docker node inspect id | jq -r '.[]["Status"]["State"]' +---- +====