Signed-off-by: Charles Smith <charles.smith@docker.com>
| ... | ... |
@@ -18,8 +18,9 @@ This topic describes key concepts to help you begin using Docker Swarm. |
| 18 | 18 |
|
| 19 | 19 |
## Swarm |
| 20 | 20 |
|
| 21 |
-**Docker Swarm** is the name for the cluster management and orchestration features |
|
| 22 |
-embedded in the Docker Engine. |
|
| 21 |
+**Docker Swarm** is the name for the cluster management and orchestration |
|
| 22 |
+features embedded in the Docker Engine. Engines that are participating in a |
|
| 23 |
+cluster are running in **Swarm mode**. |
|
| 23 | 24 |
|
| 24 | 25 |
A **Swarm** is a cluster of Docker Engines where you deploy a set of application |
| 25 | 26 |
services. When you deploy an application to a Swarm, you specify the desired |
| ... | ... |
@@ -19,9 +19,15 @@ to add worker nodes. |
| 19 | 19 |
1. Open a terminal and ssh into the machine where you want to run a worker node. |
| 20 | 20 |
This tutorial uses the name `worker1`. |
| 21 | 21 |
|
| 22 |
-2. Run `docker swarm join MANAGER-IP:PORT` to create a worker node joined to the |
|
| 23 |
-existing Swarm. Replace MANAGER-IP address of the manager node and the port |
|
| 24 |
-where the manager listens. |
|
| 22 |
+2. Run the following command to create a worker node joined to |
|
| 23 |
+the existing Swarm: |
|
| 24 |
+ |
|
| 25 |
+ ``` |
|
| 26 |
+ docker swarm join <MANAGER-IP>:<PORT> |
|
| 27 |
+ ``` |
|
| 28 |
+ |
|
| 29 |
+ Replace `<MANAGER-IP>` with the address of the manager node and `<PORT>` |
|
| 30 |
+ with the port where the manager listens. |
|
| 25 | 31 |
|
| 26 | 32 |
In the tutorial, the following command joins `worker1` to the Swarm on `manager1`: |
| 27 | 33 |
|
| ... | ... |
@@ -34,9 +40,11 @@ where the manager listens. |
| 34 | 34 |
3. Open a terminal and ssh into the machine where you want to run a second |
| 35 | 35 |
worker node. This tutorial uses the name `worker2`. |
| 36 | 36 |
|
| 37 |
-4. Run `docker swarm join MANAGER-IP:PORT` to create a worker node joined to |
|
| 38 |
-the existing Swarm. Replace MANAGER-IP address of the manager node and the port |
|
| 39 |
-where the manager listens. |
|
| 37 |
+4. Run `docker swarm join <MANAGER-IP>:<PORT>` to create a worker node joined to |
|
| 38 |
+the existing Swarm. |
|
| 39 |
+ |
|
| 40 |
+ Replace `<MANAGER-IP>` with the address of the manager node and `<PORT>` |
|
| 41 |
+ with the port where the manager listens. |
|
| 40 | 42 |
|
| 41 | 43 |
5. Open a terminal and ssh into the machine where the manager node runs and run |
| 42 | 44 |
the `docker node ls` command to see the worker nodes: |
| ... | ... |
@@ -20,7 +20,11 @@ machines. |
| 20 | 20 |
1. Open a terminal and ssh into the machine where you want to run your manager |
| 21 | 21 |
node. For example, the tutorial uses a machine named `manager1`. |
| 22 | 22 |
|
| 23 |
-2. Run `docker swarm init --listen-addr MANAGER-IP:PORT` to create a new Swarm. |
|
| 23 |
+2. Run the following command to create a new Swarm: |
|
| 24 |
+ |
|
| 25 |
+ ``` |
|
| 26 |
+ docker swarm init --listen-addr <MANAGER-IP>:<PORT> |
|
| 27 |
+ ``` |
|
| 24 | 28 |
|
| 25 | 29 |
In the tutorial, the following command creates a Swarm on the `manager1` machine: |
| 26 | 30 |
|
| ... | ... |
@@ -27,7 +27,7 @@ run your manager node. For example, the tutorial uses a machine named |
| 27 | 27 |
helloworld |
| 28 | 28 |
``` |
| 29 | 29 |
|
| 30 |
-3. Run `docker service inspect SERVICE-ID` to veriy that Swarm removed the |
|
| 30 |
+3. Run `docker service inspect <SERVICE-ID>` to veriy that Swarm removed the |
|
| 31 | 31 |
service. The CLI returns a message that the service is not found: |
| 32 | 32 |
|
| 33 | 33 |
``` |
| ... | ... |
@@ -23,14 +23,14 @@ example, the tutorial uses a machine named `manager1`. |
| 23 | 23 |
2. Run the the following command: |
| 24 | 24 |
|
| 25 | 25 |
```bash |
| 26 |
- $ docker service create --scale 1 --name helloworld alpine ping docker.com |
|
| 26 |
+ $ docker service create --replicas 1 --name helloworld alpine ping docker.com |
|
| 27 | 27 |
|
| 28 | 28 |
2zs4helqu64f3k3iuwywbk49w |
| 29 | 29 |
``` |
| 30 | 30 |
|
| 31 | 31 |
* The `docker service create` command creates the service. |
| 32 | 32 |
* The `--name` flag names the service `helloworld`. |
| 33 |
- * The `--scale` flag specifies the desired state of 1 running instance. |
|
| 33 |
+ * The `--replicas` flag specifies the desired state of 1 running instance. |
|
| 34 | 34 |
* The arguments `alpine ping docker.com` define the service as an Alpine |
| 35 | 35 |
Linux container that executes the command `ping docker.com`. |
| 36 | 36 |
|
| ... | ... |
@@ -31,16 +31,16 @@ run your manager node. For example, the tutorial uses a machine named |
| 31 | 31 |
$ docker node ls |
| 32 | 32 |
|
| 33 | 33 |
ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS LEADER |
| 34 |
- 1x2bldyhie1cj worker1 Accepted Ready Active |
|
| 35 |
- 1y3zuia1z224i worker2 Accepted Ready Active |
|
| 36 |
- 2p5bfd34mx4op * manager1 Accepted Ready Active Reachable Yes |
|
| 34 |
+ 1x2bldyhie1cj worker1 Accepted Ready Active |
|
| 35 |
+ 1y3zuia1z224i worker2 Accepted Ready Active |
|
| 36 |
+ 2p5bfd34mx4op * manager1 Accepted Ready Active Reachable Yes |
|
| 37 | 37 |
``` |
| 38 | 38 |
|
| 39 | 39 |
2. If you aren't still running the `redis` service from the [rolling |
| 40 | 40 |
update](rolling-update.md) tutorial, start it now: |
| 41 | 41 |
|
| 42 | 42 |
```bash |
| 43 |
- $ docker service create --scale 3 --name redis --update-delay 10s --update-parallelism 1 redis:3.0.6 |
|
| 43 |
+ $ docker service create --replicas 3 --name redis --update-delay 10s --update-parallelism 1 redis:3.0.6 |
|
| 44 | 44 |
|
| 45 | 45 |
69uh57k8o03jtqj9uvmteodbb |
| 46 | 46 |
``` |
| ... | ... |
@@ -50,6 +50,7 @@ tasks to different nodes: |
| 50 | 50 |
|
| 51 | 51 |
``` |
| 52 | 52 |
$ docker service tasks redis |
| 53 |
+ |
|
| 53 | 54 |
ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE |
| 54 | 55 |
3wfqsgxecktpwoyj2zjcrcn4r redis.1 redis redis:3.0.6 RUNNING 13 minutes RUNNING worker2 |
| 55 | 56 |
8lcm041z3v80w0gdkczbot0gg redis.2 redis redis:3.0.6 RUNNING 13 minutes RUNNING worker1 |
| ... | ... |
@@ -59,7 +60,7 @@ tasks to different nodes: |
| 59 | 59 |
In this case the Swarm manager distributed one task to each node. You may |
| 60 | 60 |
see the tasks distributed differently among the nodes in your environment. |
| 61 | 61 |
|
| 62 |
-4. Run `docker node update --availability drain NODE-ID` to drain a node that |
|
| 62 |
+4. Run `docker node update --availability drain <NODE-ID>` to drain a node that |
|
| 63 | 63 |
had a task assigned to it: |
| 64 | 64 |
|
| 65 | 65 |
```bash |
| ... | ... |
@@ -95,8 +96,8 @@ task assignments for the `redis` service: |
| 95 | 95 |
with `Drain` availability and creating a new task on a node with `Active` |
| 96 | 96 |
availability. |
| 97 | 97 |
|
| 98 |
-7. Run `docker node update --availability active NODE-ID` to return the drained |
|
| 99 |
-node to an active state: |
|
| 98 |
+7. Run `docker node update --availability active <NODE-ID>` to return the |
|
| 99 |
+drained node to an active state: |
|
| 100 | 100 |
|
| 101 | 101 |
```bash |
| 102 | 102 |
$ docker node update --availability active worker1 |
| ... | ... |
@@ -122,8 +123,4 @@ node to an active state: |
| 122 | 122 |
* when you set another node to `Drain` availability |
| 123 | 123 |
* when a task fails on another active node |
| 124 | 124 |
|
| 125 |
-## What's next? |
|
| 126 |
- |
|
| 127 |
-The next topic in the tutorial introduces volumes. |
|
| 128 |
- |
|
| 129 | 125 |
<p style="margin-bottom:300px"> </p> |
| ... | ... |
@@ -20,10 +20,11 @@ the Docker CLI to see details about the service running in the Swarm. |
| 20 | 20 |
run your manager node. For example, the tutorial uses a machine named |
| 21 | 21 |
`manager1`. |
| 22 | 22 |
|
| 23 |
-2. Run `docker service inspect --pretty SERVICE-ID` to display the details about |
|
| 24 |
-a service in an easily readable format. |
|
| 23 |
+2. Run `docker service inspect --pretty <SERVICE-ID>` to display the details |
|
| 24 |
+about a service in an easily readable format. |
|
| 25 | 25 |
|
| 26 | 26 |
To see the details on the `helloworld` service: |
| 27 |
+ |
|
| 27 | 28 |
``` |
| 28 | 29 |
$ docker service inspect --pretty helloworld |
| 29 | 30 |
|
| ... | ... |
@@ -33,7 +34,7 @@ a service in an easily readable format. |
| 33 | 33 |
Scale: 1 |
| 34 | 34 |
Placement: |
| 35 | 35 |
Strategy: SPREAD |
| 36 |
- UpateConfig: |
|
| 36 |
+ UpdateConfig: |
|
| 37 | 37 |
Parallelism: 1 |
| 38 | 38 |
ContainerSpec: |
| 39 | 39 |
Image: alpine |
| ... | ... |
@@ -85,7 +86,7 @@ a service in an easily readable format. |
| 85 | 85 |
] |
| 86 | 86 |
``` |
| 87 | 87 |
|
| 88 |
-4. Run `docker service tasks SERVICE-ID` to see which nodes are running the |
|
| 88 |
+4. Run `docker service tasks <SERVICE-ID>` to see which nodes are running the |
|
| 89 | 89 |
service: |
| 90 | 90 |
|
| 91 | 91 |
``` |
| ... | ... |
@@ -25,7 +25,7 @@ run your manager node. For example, the tutorial uses a machine named |
| 25 | 25 |
the swarm to update one node every 10 seconds: |
| 26 | 26 |
|
| 27 | 27 |
```bash |
| 28 |
- $ docker service create --scale 3 --name redis --update-delay 10s --update-parallelism 1 redis:3.0.6 |
|
| 28 |
+ $ docker service create --replicas 3 --name redis --update-delay 10s --update-parallelism 1 redis:3.0.6 |
|
| 29 | 29 |
|
| 30 | 30 |
8m228injfrhdym2zvzhl9k3l0 |
| 31 | 31 |
``` |
| ... | ... |
@@ -35,12 +35,13 @@ the swarm to update one node every 10 seconds: |
| 35 | 35 |
The `--update-parallelism` flag configures the number of service tasks |
| 36 | 36 |
to update simultaneously. |
| 37 | 37 |
|
| 38 |
- The `--update-delay` flag configures the time delay between updates to |
|
| 39 |
- a service task or sets of tasks. You can describe the time `T` in the number |
|
| 40 |
- of seconds `Ts`, minutes `Tm`, or hours `Th`. So `10m` indicates a 10 minute |
|
| 41 |
- delay. |
|
| 38 |
+ The `--update-delay` flag configures the time delay between updates to a |
|
| 39 |
+ service task or sets of tasks. You can describe the time `T` as a |
|
| 40 |
+ combination of the number of seconds `Ts`, minutes `Tm`, or hours `Th`. So |
|
| 41 |
+ `10m30s` indicates a 10 minute 30 second delay. |
|
| 42 | 42 |
|
| 43 | 43 |
3. Inspect the `redis` service: |
| 44 |
+ |
|
| 44 | 45 |
``` |
| 45 | 46 |
$ docker service inspect redis --pretty |
| 46 | 47 |
|
| ... | ... |
@@ -50,7 +51,7 @@ the swarm to update one node every 10 seconds: |
| 50 | 50 |
Scale: 3 |
| 51 | 51 |
Placement: |
| 52 | 52 |
Strategy: SPREAD |
| 53 |
- UpateConfig: |
|
| 53 |
+ UpdateConfig: |
|
| 54 | 54 |
Parallelism: 1 |
| 55 | 55 |
Delay: 10s |
| 56 | 56 |
ContainerSpec: |
| ... | ... |
@@ -84,7 +85,7 @@ desired state: |
| 84 | 84 |
Image: redis:3.0.7 |
| 85 | 85 |
``` |
| 86 | 86 |
|
| 87 |
-6. Run `docker service tasks TASK-ID` to watch the rolling update: |
|
| 87 |
+6. Run `docker service tasks <TASK-ID>` to watch the rolling update: |
|
| 88 | 88 |
|
| 89 | 89 |
``` |
| 90 | 90 |
$ docker service tasks redis |
| ... | ... |
@@ -24,19 +24,19 @@ run your manager node. For example, the tutorial uses a machine named |
| 24 | 24 |
2. Run the following command to change the desired state of the |
| 25 | 25 |
service runing in the Swarm: |
| 26 | 26 |
|
| 27 |
- ``` |
|
| 28 |
- $ docker service update --scale NUMBER-OF-TASKS SERVICE-ID |
|
| 27 |
+ ```bash |
|
| 28 |
+ $ docker service update --replicas <NUMBER-OF-TASKS> <SERVICE-ID> |
|
| 29 | 29 |
``` |
| 30 | 30 |
|
| 31 |
- The `--scale` flag indicates the number of tasks you want in the new desired |
|
| 32 |
- state. For example: |
|
| 31 |
+ The `--replicas` flag indicates the number of tasks you want in the new |
|
| 32 |
+ desired state. For example: |
|
| 33 | 33 |
|
| 34 |
- ``` |
|
| 35 |
- $ docker service update --scale 5 helloworld |
|
| 34 |
+ ```bash |
|
| 35 |
+ $ docker service update --replicas 5 helloworld |
|
| 36 | 36 |
helloworld |
| 37 | 37 |
``` |
| 38 | 38 |
|
| 39 |
-3. Run `docker service tasks SERVICE-ID` to see the updated task list: |
|
| 39 |
+3. Run `docker service tasks <SERVICE-ID>` to see the updated task list: |
|
| 40 | 40 |
|
| 41 | 41 |
``` |
| 42 | 42 |
$ docker service tasks helloworld |