Signed-off-by: Amit Shukla <amit.shukla@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Amit Shukla 2016-06-13 19:57:19 -07:00 committed by Tonis Tiigi
parent 12a00e6017
commit 9acf97b72a
16 changed files with 730 additions and 8 deletions

View File

@ -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_inspect](volume_inspect.md)
* [volume_ls](volume_ls.md) * [volume_ls](volume_ls.md)
* [volume_rm](volume_rm.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)

View File

@ -37,7 +37,7 @@ available on the volume where `/var/lib/docker` is mounted.
## Display Docker system information ## Display Docker system information
Here is a sample output for a daemon running on Ubuntu, using the overlay 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 $ docker -D info
Containers: 14 Containers: 14
@ -53,6 +53,11 @@ storage driver:
Plugins: Plugins:
Volume: local Volume: local
Network: bridge null host Network: bridge null host
Swarm:
NodeID: 0gac67oclbxq7
IsManager: YES
Managers: 2
Nodes: 2
Kernel Version: 4.4.0-21-generic Kernel Version: 4.4.0-21-generic
Operating System: Ubuntu 16.04 LTS Operating System: Ubuntu 16.04 LTS
OSType: linux OSType: linux

View File

@ -10,15 +10,15 @@ parent = "smn_cli"
# inspect # 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 -f, --format="" Format the output using the given go template
--help Print usage --help Print usage
--type=container|image Return JSON for specified type, permissible --type=container|image|task Return JSON for specified type, permissible
values are "image" or "container" values are "image" or "container" or "task"
-s, --size Display total file sizes if the type is container -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 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. 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 $ docker inspect --format='{{.LogPath}}' $INSTANCE_ID
**Get a Task's image name:**
$ docker inspect --format='{{.Container.Spec.Image}}' $INSTANCE_ID
**List All Port Bindings:** **List All Port Bindings:**
One can loop over arrays and maps in the results to produce simple text One can loop over arrays and maps in the results to produce simple text

View File

@ -0,0 +1,28 @@
<!--[metadata]>
+++
title = "node accept"
description = "The node accept command description and usage"
keywords = ["node, accept"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
# 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 <node name>
```
## Related information
* [node reject](node_reject.md)
* [node promote](node_promote.md)
* [node demote](node_demote.md)

View File

@ -0,0 +1,28 @@
<!--[metadata]>
+++
title = "node demote"
description = "The node demote command description and usage"
keywords = ["node, demote"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
# 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 <node name>
```
## Related information
* [node accept](node_accept.md)
* [node reject](node_reject.md)
* [node promote](node_promote.md)

View File

@ -0,0 +1,108 @@
<!--[metadata]>
+++
title = "node inspect"
description = "The node inspect command description and usage"
keywords = ["node, inspect"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)

View File

@ -0,0 +1,89 @@
<!--[metadata]>
+++
title = "node ls"
description = "The node ls command description and usage"
keywords = ["node, list"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)

View File

@ -0,0 +1,28 @@
<!--[metadata]>
+++
title = "node promote"
description = "The node promote command description and usage"
keywords = ["node, promote"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
# 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 <node name>
```
## Related information
* [node accept](node_accept.md)
* [node reject](node_reject.md)
* [node demote](node_demote.md)

View File

@ -0,0 +1,28 @@
<!--[metadata]>
+++
title = "node reject"
description = "The node reject command description and usage"
keywords = ["node, reject"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
# 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 <node name>
```
## Related information
* [node accept](node_accept.md)
* [node promote](node_promote.md)
* [node demote](node_demote.md)

View File

@ -0,0 +1,38 @@
<!--[metadata]>
+++
title = "node rm"
description = "The node rm command description and usage"
keywords = ["node, remove"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)

View File

@ -0,0 +1,94 @@
<!--[metadata]>
+++
title = "node tasks"
description = "The node tasks command description and usage"
keywords = ["node, tasks"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)

View File

@ -0,0 +1,26 @@
<!--[metadata]>
+++
title = "node update"
description = "The node update command description and usage"
keywords = ["resources, update, dynamically"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)

View File

@ -0,0 +1,69 @@
<!--[metadata]>
+++
title = "swarm init"
description = "The swarm init command description and usage"
keywords = ["swarm, init"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)

View File

@ -0,0 +1,68 @@
<!--[metadata]>
+++
title = "swarm join"
description = "The swarm join command description and usage"
keywords = ["swarm, join"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)

View File

@ -0,0 +1,52 @@
<!--[metadata]>
+++
title = "swarm leave"
description = "The swarm leave command description and usage"
keywords = ["swarm, leave"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)

View File

@ -0,0 +1,37 @@
<!--[metadata]>
+++
title = "swarm update"
description = "The swarm update command description and usage"
keywords = ["swarm, update"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
**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)