Skip to content

Commit 9acf97b

Browse files
amitshuklatonistiigi
authored andcommitted
CLI docs
Signed-off-by: Amit Shukla <amit.shukla@docker.com> Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
1 parent 12a00e6 commit 9acf97b

16 files changed

Lines changed: 730 additions & 8 deletions

docs/reference/commandline/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,23 @@ You start the Docker daemon with the command line. How you start the daemon affe
8686
* [volume_inspect](volume_inspect.md)
8787
* [volume_ls](volume_ls.md)
8888
* [volume_rm](volume_rm.md)
89+
90+
### Swarm node commands
91+
92+
* [node_accept](node_accept.md)
93+
* [node_reject](node_reject.md)
94+
* [node_promote](node_promote.md)
95+
* [node_demote](node_demote.md)
96+
* [node_inspect](node_inspect.md)
97+
* [node_update](node_update.md)
98+
* [node_tasks](node_tasks.md)
99+
* [node_ls](node_ls.md)
100+
* [node_rm](node_rm.md)
101+
102+
### Swarm swarm commands
103+
104+
* [swarm init](swarm_init.md)
105+
* [swarm join](swarm_join.md)
106+
* [swarm leave](swarm_leave.md)
107+
* [swarm update](swarm_update.md)
108+

docs/reference/commandline/info.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ available on the volume where `/var/lib/docker` is mounted.
3737
## Display Docker system information
3838

3939
Here is a sample output for a daemon running on Ubuntu, using the overlay
40-
storage driver:
40+
storage driver and a node that is part of a 2 node Swarm cluster:
4141

4242
$ docker -D info
4343
Containers: 14
@@ -53,6 +53,11 @@ storage driver:
5353
Plugins:
5454
Volume: local
5555
Network: bridge null host
56+
Swarm:
57+
NodeID: 0gac67oclbxq7
58+
IsManager: YES
59+
Managers: 2
60+
Nodes: 2
5661
Kernel Version: 4.4.0-21-generic
5762
Operating System: Ubuntu 16.04 LTS
5863
OSType: linux

docs/reference/commandline/inspect.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ parent = "smn_cli"
1010

1111
# inspect
1212

13-
Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]
13+
Usage: docker inspect [OPTIONS] CONTAINER|IMAGE|TASK [CONTAINER|IMAGE|TASK...]
1414

15-
Return low-level information on a container or image
15+
Return low-level information on a container or image or task
1616

17-
-f, --format="" Format the output using the given go template
18-
--help Print usage
19-
--type=container|image Return JSON for specified type, permissible
20-
values are "image" or "container"
21-
-s, --size Display total file sizes if the type is container
17+
-f, --format="" Format the output using the given go template
18+
--help Print usage
19+
--type=container|image|task Return JSON for specified type, permissible
20+
values are "image" or "container" or "task"
21+
-s, --size Display total file sizes if the type is container
2222

2323
By default, this will render all results in a JSON array. If the container and
2424
image have the same name, this will return container JSON for unspecified type.
@@ -47,6 +47,10 @@ straightforward manner.
4747

4848
$ docker inspect --format='{{.LogPath}}' $INSTANCE_ID
4949

50+
**Get a Task's image name:**
51+
52+
$ docker inspect --format='{{.Container.Spec.Image}}' $INSTANCE_ID
53+
5054
**List All Port Bindings:**
5155

5256
One can loop over arrays and maps in the results to produce simple text
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--[metadata]>
2+
+++
3+
title = "node accept"
4+
description = "The node accept command description and usage"
5+
keywords = ["node, accept"]
6+
[menu.main]
7+
parent = "smn_cli"
8+
+++
9+
<![end-metadata]-->
10+
11+
# node accept
12+
13+
Usage: docker node accept NODE [NODE...]
14+
15+
Accept a node in the swarm
16+
17+
Accept a node into the swarm. This command targets a docker engine that is a manager in the swarm cluster.
18+
19+
20+
```bash
21+
$ docker node accept <node name>
22+
```
23+
24+
## Related information
25+
26+
* [node reject](node_reject.md)
27+
* [node promote](node_promote.md)
28+
* [node demote](node_demote.md)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--[metadata]>
2+
+++
3+
title = "node demote"
4+
description = "The node demote command description and usage"
5+
keywords = ["node, demote"]
6+
[menu.main]
7+
parent = "smn_cli"
8+
+++
9+
<![end-metadata]-->
10+
11+
# node demote
12+
13+
Usage: docker node demote NODE [NODE...]
14+
15+
Demote a node as manager in the swarm
16+
17+
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.
18+
19+
20+
```bash
21+
$ docker node demote <node name>
22+
```
23+
24+
## Related information
25+
26+
* [node accept](node_accept.md)
27+
* [node reject](node_reject.md)
28+
* [node promote](node_promote.md)
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<!--[metadata]>
2+
+++
3+
title = "node inspect"
4+
description = "The node inspect command description and usage"
5+
keywords = ["node, inspect"]
6+
[menu.main]
7+
parent = "smn_cli"
8+
+++
9+
<![end-metadata]-->
10+
11+
**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes.
12+
13+
# node inspect
14+
15+
Usage: docker node inspect [OPTIONS] self|NODE [NODE...]
16+
17+
Return low-level information on a volume
18+
19+
-f, --format= Format the output using the given go template.
20+
--help Print usage
21+
-p, --pretty Print the information in a human friendly format.
22+
23+
Returns information about a node. By default, this command renders all results
24+
in a JSON array. You can specify an alternate format to execute a
25+
given template for each result. Go's
26+
[text/template](http://golang.org/pkg/text/template/) package describes all the
27+
details of the format.
28+
29+
Example output:
30+
31+
$ docker node inspect swarm-manager
32+
[
33+
{
34+
"ID": "0gac67oclbxq7",
35+
"Version": {
36+
"Index": 2028
37+
},
38+
"CreatedAt": "2016-06-06T20:49:32.720047494Z",
39+
"UpdatedAt": "2016-06-07T00:23:31.207632893Z",
40+
"Spec": {
41+
"Role": "MANAGER",
42+
"Membership": "ACCEPTED",
43+
"Availability": "ACTIVE"
44+
},
45+
"Description": {
46+
"Hostname": "swarm-manager",
47+
"Platform": {
48+
"Architecture": "x86_64",
49+
"OS": "linux"
50+
},
51+
"Resources": {
52+
"NanoCPUs": 1000000000,
53+
"MemoryBytes": 1044250624
54+
},
55+
"Engine": {
56+
"EngineVersion": "1.12.0",
57+
"Labels": {
58+
"provider": "virtualbox"
59+
}
60+
}
61+
},
62+
"Status": {
63+
"State": "READY"
64+
},
65+
"Manager": {
66+
"Raft": {
67+
"RaftID": 2143745093569717375,
68+
"Addr": "192.168.99.118:4500",
69+
"Status": {
70+
"Leader": true,
71+
"Reachability": "REACHABLE"
72+
}
73+
}
74+
},
75+
"Attachment": {},
76+
}
77+
]
78+
79+
$ docker node inspect --format '{{ .Manager.Raft.Status.Leader }}' self
80+
false
81+
82+
$ docker node inspect --pretty self
83+
ID: 2otfhz83efcc7
84+
Hostname: ad960a848573
85+
Status:
86+
State: Ready
87+
Availability: Active
88+
Manager Status:
89+
Address: 172.17.0.2:2377
90+
Raft status: Reachable
91+
Leader: Yes
92+
Platform:
93+
Operating System: linux
94+
Architecture: x86_64
95+
Resources:
96+
CPUs: 4
97+
Memory: 7.704 GiB
98+
Plugins:
99+
Network: overlay, bridge, null, host, overlay
100+
Volume: local
101+
Engine Version: 1.12.0
102+
103+
## Related information
104+
105+
* [node update](node_update.md)
106+
* [node tasks](node_tasks.md)
107+
* [node ls](node_ls.md)
108+
* [node rm](node_rm.md)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<!--[metadata]>
2+
+++
3+
title = "node ls"
4+
description = "The node ls command description and usage"
5+
keywords = ["node, list"]
6+
[menu.main]
7+
parent = "smn_cli"
8+
+++
9+
<![end-metadata]-->
10+
11+
**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes.
12+
13+
# node ls
14+
15+
Usage: docker node ls [OPTIONS]
16+
17+
List nodes in the swarm
18+
19+
Aliases:
20+
ls, list
21+
22+
Options:
23+
-f, --filter value Filter output based on conditions provided
24+
--help Print usage
25+
-q, --quiet Only display IDs
26+
27+
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.
28+
29+
Example output:
30+
31+
$ docker node ls
32+
ID NAME STATUS AVAILABILITY MANAGER STATUS LEADER
33+
0gac67oclbxq swarm-master Ready Active Reachable Yes
34+
0pwvm3ve66q7 swarm-node-02 Ready Active
35+
15xwihgw71aw * swarm-node-01 Ready Active Reachable
36+
37+
38+
## Filtering
39+
40+
The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more
41+
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
42+
43+
The currently supported filters are:
44+
45+
* name
46+
* id
47+
* label
48+
* desired_state
49+
50+
### name
51+
52+
The `name` filter matches on all or part of a tasks's name.
53+
54+
The following filter matches the node with a name equal to `swarm-master` string.
55+
56+
$ docker node ls -f name=swarm-master
57+
ID NAME STATUS AVAILABILITY MANAGER STATUS LEADER
58+
0gac67oclbxq * swarm-master Ready Active Reachable Yes
59+
60+
### id
61+
62+
The `id` filter matches all or part of a node's id.
63+
64+
$ docker node ls -f id=0
65+
ID NAME STATUS AVAILABILITY MANAGER STATUS LEADER
66+
0gac67oclbxq * swarm-master Ready Active Reachable Yes
67+
0pwvm3ve66q7 swarm-node-02 Ready Active
68+
69+
70+
#### label
71+
72+
The `label` filter matches tasks based on the presence of a `label` alone or a `label` and a
73+
value.
74+
75+
The following filter matches nodes with the `usage` label regardless of its value.
76+
77+
```bash
78+
$ docker node ls -f "label=foo"
79+
ID NAME STATUS AVAILABILITY MANAGER STATUS LEADER
80+
15xwihgw71aw * swarm-node-01 Ready Active Reachable
81+
```
82+
83+
84+
## Related information
85+
86+
* [node inspect](node_inspect.md)
87+
* [node update](node_update.md)
88+
* [node tasks](node_tasks.md)
89+
* [node rm](node_rm.md)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--[metadata]>
2+
+++
3+
title = "node promote"
4+
description = "The node promote command description and usage"
5+
keywords = ["node, promote"]
6+
[menu.main]
7+
parent = "smn_cli"
8+
+++
9+
<![end-metadata]-->
10+
11+
# node promote
12+
13+
Usage: docker node promote NODE [NODE...]
14+
15+
Promote a node as manager in the swarm
16+
17+
Promotes a node that is pending a promotion to manager. This command targets a docker engine that is a manager in the swarm cluster.
18+
19+
20+
```bash
21+
$ docker node promote <node name>
22+
```
23+
24+
## Related information
25+
26+
* [node accept](node_accept.md)
27+
* [node reject](node_reject.md)
28+
* [node demote](node_demote.md)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--[metadata]>
2+
+++
3+
title = "node reject"
4+
description = "The node reject command description and usage"
5+
keywords = ["node, reject"]
6+
[menu.main]
7+
parent = "smn_cli"
8+
+++
9+
<![end-metadata]-->
10+
11+
# node reject
12+
13+
Usage: docker node reject NODE [NODE...]
14+
15+
Reject a node from the swarm
16+
17+
Reject a node from joining the swarm. This command targets a docker engine that is a manager in the swarm cluster.
18+
19+
20+
```bash
21+
$ docker node reject <node name>
22+
```
23+
24+
## Related information
25+
26+
* [node accept](node_accept.md)
27+
* [node promote](node_promote.md)
28+
* [node demote](node_demote.md)

0 commit comments

Comments
 (0)