diff --git a/docs/reference/commandline/index.md b/docs/reference/commandline/index.md index db71e48c0c..fff0dd9d44 100644 --- a/docs/reference/commandline/index.md +++ b/docs/reference/commandline/index.md @@ -86,3 +86,23 @@ You start the Docker daemon with the command line. How you start the daemon affe * [volume_inspect](volume_inspect.md) * [volume_ls](volume_ls.md) * [volume_rm](volume_rm.md) + +### Swarm node commands + +* [node_accept](node_accept.md) +* [node_reject](node_reject.md) +* [node_promote](node_promote.md) +* [node_demote](node_demote.md) +* [node_inspect](node_inspect.md) +* [node_update](node_update.md) +* [node_tasks](node_tasks.md) +* [node_ls](node_ls.md) +* [node_rm](node_rm.md) + +### Swarm swarm commands + +* [swarm init](swarm_init.md) +* [swarm join](swarm_join.md) +* [swarm leave](swarm_leave.md) +* [swarm update](swarm_update.md) + diff --git a/docs/reference/commandline/info.md b/docs/reference/commandline/info.md index 8e171fecdd..1303aa0435 100644 --- a/docs/reference/commandline/info.md +++ b/docs/reference/commandline/info.md @@ -37,7 +37,7 @@ available on the volume where `/var/lib/docker` is mounted. ## Display Docker system information Here is a sample output for a daemon running on Ubuntu, using the overlay -storage driver: +storage driver and a node that is part of a 2 node Swarm cluster: $ docker -D info Containers: 14 @@ -53,6 +53,11 @@ storage driver: Plugins: Volume: local Network: bridge null host + Swarm: + NodeID: 0gac67oclbxq7 + IsManager: YES + Managers: 2 + Nodes: 2 Kernel Version: 4.4.0-21-generic Operating System: Ubuntu 16.04 LTS OSType: linux diff --git a/docs/reference/commandline/inspect.md b/docs/reference/commandline/inspect.md index 38d4098c0c..7220d69f5c 100644 --- a/docs/reference/commandline/inspect.md +++ b/docs/reference/commandline/inspect.md @@ -10,15 +10,15 @@ parent = "smn_cli" # inspect - Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...] + Usage: docker inspect [OPTIONS] CONTAINER|IMAGE|TASK [CONTAINER|IMAGE|TASK...] - Return low-level information on a container or image + Return low-level information on a container or image or task - -f, --format="" Format the output using the given go template - --help Print usage - --type=container|image Return JSON for specified type, permissible - values are "image" or "container" - -s, --size Display total file sizes if the type is container + -f, --format="" Format the output using the given go template + --help Print usage + --type=container|image|task Return JSON for specified type, permissible + values are "image" or "container" or "task" + -s, --size Display total file sizes if the type is container By default, this will render all results in a JSON array. If the container and image have the same name, this will return container JSON for unspecified type. @@ -47,6 +47,10 @@ straightforward manner. $ docker inspect --format='{{.LogPath}}' $INSTANCE_ID +**Get a Task's image name:** + + $ docker inspect --format='{{.Container.Spec.Image}}' $INSTANCE_ID + **List All Port Bindings:** One can loop over arrays and maps in the results to produce simple text diff --git a/docs/reference/commandline/node_accept.md b/docs/reference/commandline/node_accept.md new file mode 100644 index 0000000000..cc1100e84d --- /dev/null +++ b/docs/reference/commandline/node_accept.md @@ -0,0 +1,28 @@ + + +# node accept + + Usage: docker node accept NODE [NODE...] + + Accept a node in the swarm + +Accept a node into the swarm. This command targets a docker engine that is a manager in the swarm cluster. + + +```bash +$ docker node accept +``` + +## Related information + +* [node reject](node_reject.md) +* [node promote](node_promote.md) +* [node demote](node_demote.md) diff --git a/docs/reference/commandline/node_demote.md b/docs/reference/commandline/node_demote.md new file mode 100644 index 0000000000..9393e80da1 --- /dev/null +++ b/docs/reference/commandline/node_demote.md @@ -0,0 +1,28 @@ + + +# node demote + + Usage: docker node demote NODE [NODE...] + + Demote a node as manager in the swarm + +Demotes an existing Manager so that it is no longer a manager. This command targets a docker engine that is a manager in the swarm cluster. + + +```bash +$ docker node demote +``` + +## Related information + +* [node accept](node_accept.md) +* [node reject](node_reject.md) +* [node promote](node_promote.md) diff --git a/docs/reference/commandline/node_inspect.md b/docs/reference/commandline/node_inspect.md new file mode 100644 index 0000000000..48119c1693 --- /dev/null +++ b/docs/reference/commandline/node_inspect.md @@ -0,0 +1,108 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +# node inspect + + Usage: docker node inspect [OPTIONS] self|NODE [NODE...] + + Return low-level information on a volume + + -f, --format= Format the output using the given go template. + --help Print usage + -p, --pretty Print the information in a human friendly format. + +Returns information about a node. By default, this command renders all results +in a JSON array. You can specify an alternate format to execute a +given template for each result. Go's +[text/template](http://golang.org/pkg/text/template/) package describes all the +details of the format. + +Example output: + + $ docker node inspect swarm-manager + [ + { + "ID": "0gac67oclbxq7", + "Version": { + "Index": 2028 + }, + "CreatedAt": "2016-06-06T20:49:32.720047494Z", + "UpdatedAt": "2016-06-07T00:23:31.207632893Z", + "Spec": { + "Role": "MANAGER", + "Membership": "ACCEPTED", + "Availability": "ACTIVE" + }, + "Description": { + "Hostname": "swarm-manager", + "Platform": { + "Architecture": "x86_64", + "OS": "linux" + }, + "Resources": { + "NanoCPUs": 1000000000, + "MemoryBytes": 1044250624 + }, + "Engine": { + "EngineVersion": "1.12.0", + "Labels": { + "provider": "virtualbox" + } + } + }, + "Status": { + "State": "READY" + }, + "Manager": { + "Raft": { + "RaftID": 2143745093569717375, + "Addr": "192.168.99.118:4500", + "Status": { + "Leader": true, + "Reachability": "REACHABLE" + } + } + }, + "Attachment": {}, + } + ] + + $ docker node inspect --format '{{ .Manager.Raft.Status.Leader }}' self + false + + $ docker node inspect --pretty self + ID: 2otfhz83efcc7 + Hostname: ad960a848573 + Status: + State: Ready + Availability: Active + Manager Status: + Address: 172.17.0.2:2377 + Raft status: Reachable + Leader: Yes + Platform: + Operating System: linux + Architecture: x86_64 + Resources: + CPUs: 4 + Memory: 7.704 GiB + Plugins: + Network: overlay, bridge, null, host, overlay + Volume: local + Engine Version: 1.12.0 + +## Related information + +* [node update](node_update.md) +* [node tasks](node_tasks.md) +* [node ls](node_ls.md) +* [node rm](node_rm.md) diff --git a/docs/reference/commandline/node_ls.md b/docs/reference/commandline/node_ls.md new file mode 100644 index 0000000000..ce82f6b4b8 --- /dev/null +++ b/docs/reference/commandline/node_ls.md @@ -0,0 +1,89 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +# node ls + + Usage: docker node ls [OPTIONS] + + List nodes in the swarm + + Aliases: + ls, list + + Options: + -f, --filter value Filter output based on conditions provided + --help Print usage + -q, --quiet Only display IDs + +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. + +Example output: + + $ docker node ls + ID NAME STATUS AVAILABILITY MANAGER STATUS LEADER + 0gac67oclbxq swarm-master Ready Active Reachable Yes + 0pwvm3ve66q7 swarm-node-02 Ready Active + 15xwihgw71aw * swarm-node-01 Ready Active Reachable + + +## Filtering + +The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more +than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`) + +The currently supported filters are: + +* name +* id +* label +* desired_state + +### name + +The `name` filter matches on all or part of a tasks's name. + +The following filter matches the node with a name equal to `swarm-master` string. + + $ docker node ls -f name=swarm-master + ID NAME STATUS AVAILABILITY MANAGER STATUS LEADER + 0gac67oclbxq * swarm-master Ready Active Reachable Yes + +### id + +The `id` filter matches all or part of a node's id. + + $ docker node ls -f id=0 + ID NAME STATUS AVAILABILITY MANAGER STATUS LEADER + 0gac67oclbxq * swarm-master Ready Active Reachable Yes + 0pwvm3ve66q7 swarm-node-02 Ready Active + + +#### label + +The `label` filter matches tasks based on the presence of a `label` alone or a `label` and a +value. + +The following filter matches nodes with the `usage` label regardless of its value. + +```bash +$ docker node ls -f "label=foo" +ID NAME STATUS AVAILABILITY MANAGER STATUS LEADER +15xwihgw71aw * swarm-node-01 Ready Active Reachable +``` + + +## Related information + +* [node inspect](node_inspect.md) +* [node update](node_update.md) +* [node tasks](node_tasks.md) +* [node rm](node_rm.md) diff --git a/docs/reference/commandline/node_promote.md b/docs/reference/commandline/node_promote.md new file mode 100644 index 0000000000..933f362081 --- /dev/null +++ b/docs/reference/commandline/node_promote.md @@ -0,0 +1,28 @@ + + +# node promote + + Usage: docker node promote NODE [NODE...] + + Promote a node as manager in the swarm + +Promotes a node that is pending a promotion to manager. This command targets a docker engine that is a manager in the swarm cluster. + + +```bash +$ docker node promote +``` + +## Related information + +* [node accept](node_accept.md) +* [node reject](node_reject.md) +* [node demote](node_demote.md) diff --git a/docs/reference/commandline/node_reject.md b/docs/reference/commandline/node_reject.md new file mode 100644 index 0000000000..56dbe8bf45 --- /dev/null +++ b/docs/reference/commandline/node_reject.md @@ -0,0 +1,28 @@ + + +# node reject + + Usage: docker node reject NODE [NODE...] + + Reject a node from the swarm + +Reject a node from joining the swarm. This command targets a docker engine that is a manager in the swarm cluster. + + +```bash +$ docker node reject +``` + +## Related information + +* [node accept](node_accept.md) +* [node promote](node_promote.md) +* [node demote](node_demote.md) diff --git a/docs/reference/commandline/node_rm.md b/docs/reference/commandline/node_rm.md new file mode 100644 index 0000000000..6eb9a873cf --- /dev/null +++ b/docs/reference/commandline/node_rm.md @@ -0,0 +1,38 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +# node rm + + Usage: docker node rm NODE [NODE...] + + Remove a node from the swarm + + Aliases: + rm, remove + + Options: + --help Print usage + +Removes nodes that are specified. + +Example output: + + $ docker node rm swarm-node-02 + Node swarm-node-02 removed from Swarm + + +## Related information + +* [node inspect](node_inspect.md) +* [node update](node_update.md) +* [node tasks](node_tasks.md) +* [node ls](node_ls.md) diff --git a/docs/reference/commandline/node_tasks.md b/docs/reference/commandline/node_tasks.md new file mode 100644 index 0000000000..5bd6832a8a --- /dev/null +++ b/docs/reference/commandline/node_tasks.md @@ -0,0 +1,94 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +# node tasks + + Usage: docker node tasks [OPTIONS] NODE + + List tasks running on a node + + Options: + -a, --all Display all instances + -f, --filter value Filter output based on conditions provided + --help Print usage + -n, --no-resolve Do not map IDs to Names + +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. + +Example output: + + $ docker node tasks swarm-master + ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE + dx2g0fe3zsdb6y6q453f8dqw2 redis.1 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + f33pcf8lwhs4c1t4kq8szwzta redis.4 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + 5v26yzixl3one3ptjyqqbd0ro redis.5 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + adcaphlhsfr30d47lby6walg6 redis.8 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + chancjvk9tex6768uzzacslq2 redis.9 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + + +## Filtering + +The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more +than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`) + +The currently supported filters are: + +* name +* id +* label +* desired_state + +### name + +The `name` filter matches on all or part of a task's name. + +The following filter matches all tasks with a name containing the `redis` string. + + $ docker node tasks -f name=redis swarm-master + ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE + dx2g0fe3zsdb6y6q453f8dqw2 redis.1 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + f33pcf8lwhs4c1t4kq8szwzta redis.4 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + 5v26yzixl3one3ptjyqqbd0ro redis.5 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + adcaphlhsfr30d47lby6walg6 redis.8 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + chancjvk9tex6768uzzacslq2 redis.9 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + + +### id + +The `id` filter matches a task's id. + + $ docker node tasks -f id=f33pcf8lwhs4c1t4kq8szwzta swarm-master + ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE + f33pcf8lwhs4c1t4kq8szwzta redis.4 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master + + +#### label + +The `label` filter matches tasks based on the presence of a `label` alone or a `label` and a +value. + +The following filter matches tasks with the `usage` label regardless of its value. + +```bash +$ docker node tasks -f "label=usage" +ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE +dx2g0fe3zsdb6y6q453f8dqw2 redis.1 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master +f33pcf8lwhs4c1t4kq8szwzta redis.4 redis redis:3.0.6 RUNNING RUNNING 2 hours swarm-master +``` + + +## Related information + +* [node inspect](node_inspect.md) +* [node update](node_update.md) +* [node ls](node_ls.md) +* [node rm](node_rm.md) diff --git a/docs/reference/commandline/node_update.md b/docs/reference/commandline/node_update.md new file mode 100644 index 0000000000..a48712d6c9 --- /dev/null +++ b/docs/reference/commandline/node_update.md @@ -0,0 +1,26 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +## update + + Usage: docker node update [OPTIONS] Node + + Update a node + + + +## Related information + +* [node inspect](node_inspect.md) +* [node tasks](node_tasks.md) +* [node ls](node_ls.md) +* [node rm](node_rm.md) diff --git a/docs/reference/commandline/swarm_init.md b/docs/reference/commandline/swarm_init.md new file mode 100644 index 0000000000..d1e20b6175 --- /dev/null +++ b/docs/reference/commandline/swarm_init.md @@ -0,0 +1,69 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +# swarm init + + Usage: docker swarm init [OPTIONS] + + Initialize a Swarm. + + Options: + --auto-accept value Acceptance policy (default [worker,manager]) + --force-new-cluster Force create a new cluster from current state. + --help Print usage + --listen-addr value Listen address (default 0.0.0.0:2377) + --secret string Set secret value needed to accept nodes into cluster + +Initialize a Swarm cluster. The docker engine targeted by this command becomes a manager +in the newly created one node Swarm cluster. + + +```bash +$ docker swarm init --listen-addr 192.168.99.121:2377 +Initializing a new swarm +$ docker node ls +ID NAME STATUS AVAILABILITY/MEMBERSHIP MANAGER STATUS LEADER +3l1f6uzcuoa3 * swarm-master READY ACTIVE REACHABLE Yes +``` + +### --auto-accept value + +This flag controls node acceptance into the cluster. By default, both `worker` and `manager` +nodes are auto accepted by the cluster. This can be changed by specifing what kinds of nodes +can be auto-accepted into the cluster. If auto-accept is not turned on, then +[node accept](node_accept.md) can be used to explicitly accept a node into the cluster. + +For example, the following initializes a cluster with auto-acceptance of workers, but not managers + + +```bash +$ docker swarm init --listen-addr 192.168.99.121:2377 --auto-accept worker +Initializing a new swarm +``` + +### `--force-new-cluster` + +This flag forces an existing node that was part of a quorum that was lost to restart as a single node Manager without losing its data + +### `--listen-addr value` + +The node listens for inbound Swarm manager traffic on this IP:PORT + +### `--secret string` + +Secret value needed to accept nodes into the Swarm + +## Related information + +* [swarm join](swarm_join.md) +* [swarm leave](swarm_leave.md) +* [swarm update](swarm_update.md) diff --git a/docs/reference/commandline/swarm_join.md b/docs/reference/commandline/swarm_join.md new file mode 100644 index 0000000000..a08c50abca --- /dev/null +++ b/docs/reference/commandline/swarm_join.md @@ -0,0 +1,68 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +# swarm join + + Usage: docker swarm join [OPTIONS] HOST:PORT + + Join a Swarm as a node and/or manager. + + Options: + --help Print usage + --listen-addr value Listen address (default 0.0.0.0:2377) + --manager Try joining as a manager. + --secret string Secret for node acceptance + +Join a node to a Swarm cluster. If the `--manager` flag is specified, the docker engine +targeted by this command becomes a `manager`. If it is not specified, it becomes a `worker`. + +### Join a node to swarm as a manager + +```bash +$ docker swarm join --manager --listen-addr 192.168.99.122:2377 192.168.99.121:2377 +This node is attempting to join a Swarm as a manager. +$ docker node ls +ID NAME STATUS AVAILABILITY/MEMBERSHIP MANAGER STATUS LEADER +2fg70txcrde2 swarm-node-01 READY ACTIVE REACHABLE +3l1f6uzcuoa3 * swarm-master READY ACTIVE REACHABLE Yes +``` + +### Join a node to swarm as a worker + +```bash +$ docker swarm join --listen-addr 192.168.99.123:2377 192.168.99.121:2377 +This node is attempting to join a Swarm. +$ docker node ls +ID NAME STATUS AVAILABILITY/MEMBERSHIP MANAGER STATUS LEADER +04zm7ue1fd1q swarm-node-02 READY ACTIVE +2fg70txcrde2 swarm-node-01 READY ACTIVE REACHABLE +3l1f6uzcuoa3 * swarm-master READY ACTIVE REACHABLE Yes +``` + +### `--manager` + +Joins the node as a manager + +### `--listen-addr value` + +The node listens for inbound Swarm manager traffic on this IP:PORT + +### `--secret string` + +Secret value required for nodes to join the swarm + + +## Related information + +* [swarm init](swarm_init.md) +* [swarm leave](swarm_leave.md) +* [swarm update](swarm_update.md) diff --git a/docs/reference/commandline/swarm_leave.md b/docs/reference/commandline/swarm_leave.md new file mode 100644 index 0000000000..d6ce6de6f5 --- /dev/null +++ b/docs/reference/commandline/swarm_leave.md @@ -0,0 +1,52 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +# swarm leave + + Usage: docker swarm leave + + Leave a Swarm swarm. + + Options: + --help Print usage + +This command causes the node to leave the swarm. + +On a manager node: +```bash +$ docker node ls +ID NAME STATUS AVAILABILITY/MEMBERSHIP MANAGER STATUS LEADER +04zm7ue1fd1q swarm-node-02 READY ACTIVE +2fg70txcrde2 swarm-node-01 READY ACTIVE REACHABLE +3l1f6uzcuoa3 * swarm-master READY ACTIVE REACHABLE Yes +``` + +On a worker node: +```bash +$ docker swarm leave +Node left the default swarm. +``` + +On a manager node: +```bash +$ docker node ls +ID NAME STATUS AVAILABILITY/MEMBERSHIP MANAGER STATUS LEADER +04zm7ue1fd1q swarm-node-02 DOWN ACTIVE +2fg70txcrde2 swarm-node-01 READY ACTIVE REACHABLE +3l1f6uzcuoa3 * swarm-master READY ACTIVE REACHABLE Yes +``` + +## Related information + +* [swarm init](swarm_init.md) +* [swarm join](swarm_join.md) +* [swarm update](swarm_update.md) diff --git a/docs/reference/commandline/swarm_update.md b/docs/reference/commandline/swarm_update.md new file mode 100644 index 0000000000..26a06a734c --- /dev/null +++ b/docs/reference/commandline/swarm_update.md @@ -0,0 +1,37 @@ + + +**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes. + +# swarm update + + Usage: docker swarm update [OPTIONS] + + update the Swarm. + + Options: + --auto-accept value Acceptance policy (default [worker,manager]) + --help Print usage + --secret string Set secret value needed to accept nodes into cluster + + +Updates a Swarm cluster with new parameter values. This command must target a manager node. + + +```bash +$ docker swarm update --auto-accept manager +``` + +## Related information + +* [swarm init](swarm_init.md) +* [swarm join](swarm_join.md) +* [swarm leave](swarm_leave.md) +