You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: swarm-mode/beginner-tutorial/README.md
+16-10
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,29 @@
2
2
Docker Engine 1.12 includes swarm mode for natively managing a cluster of Docker Engines called a swarm. You can use the Docker CLI to create a swarm, deploy application services to a swarm, and manage swarm behavior. This tutorial uses [Docker Machine](https://docs.docker.com/machine/) to create multiple nodes on your desktop. If you prefer you can create those nodes in your own cloud or on multiple machines.
3
3
4
4
## Preparation
5
-
You need to have Docker and Docker Machine installed on your machine. [Download Docker](https://docker.com/getdocker) and install it.
5
+
You need to have Docker and Docker Machine installed on your system. [Download Docker](https://docker.com/getdocker) for your platform and install it.
6
+
7
+
>**Tips:**
8
+
>
9
+
* If you are using Docker for Mac or Docker for Windows, you already have Docker Machine, as it is installed with those applications. See [Download Docker for Mac](https://docs.docker.com/docker-for-mac/#/download-docker-for-mac) and [Download Docker for Windows](https://docs.docker.com/docker-for-windows/#/download-docker-for-windows) for install options and details on what gets installed.
10
+
>
11
+
* If you are using Docker directly on a Linux system, you will need to [install Docker Machine](https://docs.docker.com/machine/install-machine/) (after installing [Docker Engine](https://docs.docker.com/engine/installation/linux/)).
6
12
7
13
## Creating the nodes and Swarm
8
14
[Docker Machine](https://docs.docker.com/machine/overview/) can be used to:
9
15
* Install and run Docker on Mac or Windows
10
16
* Provision and manage multiple remote Docker hosts
11
-
* Provision Swarm clusters
17
+
* Provision Swarm clusters
12
18
13
19
But it can also be used to create multiple nodes on your local machine. There's a [bash script](https://github.com/ManoMarks/labs/blob/master/swarm-mode/beginner-tutorial/swarm-node-vbox-setup.sh) in this repository that does just that and creates a swarm. Let's walk through the different steps of this script.
14
20
15
-
This first step creates three machines, and names the machines manager1, manager2, and manager3
21
+
This first step creates three machines, and names the machines manager1, manager2, and manager3
16
22
```
17
23
#!/bin/bash
18
24
19
25
# Swarm mode using Docker Machine
20
26
21
-
#This configures the number of workers and managers in the swarm
27
+
#This configures the number of workers and managers in the swarm
22
28
managers=3
23
29
workers=3
24
30
@@ -271,7 +277,7 @@ ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
271
277
7eljvvg0icxlw20od5f51oq8t manager2 Ready Active Reachable
272
278
8awcmkj3sd9nv1pi77i6mdb1i worker1 Ready Drain
273
279
avu80ol573rzepx8ov80ygzxz worker2 Ready Active
274
-
bxn1iivy8w7faeugpep76w50j worker3 Ready Active
280
+
bxn1iivy8w7faeugpep76w50j worker3 Ready Active
275
281
```
276
282
277
283
You can also scale down the service
@@ -299,7 +305,7 @@ aivwszsjhhpky43t3x7o8ezz9 web.10 nginx:latest worker2 Shutdown Sh
299
305
7zg9eki4610maigr1xwrx7zqk web.14 nginx:latest manager3 Shutdown Shutdown 54 seconds ago
300
306
4z2c9j20gwsasosvj7mkzlyhc web.15 nginx:latest manager2 Shutdown Shutdown 54 seconds ago
301
307
```
302
-
308
+
303
309
Now bring `worker1` back online and show it's new availability
304
310
```
305
311
$ docker-machine ssh manager1 "docker node update --availability active worker1"
@@ -340,19 +346,19 @@ ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
340
346
7eljvvg0icxlw20od5f51oq8t * manager2 Ready Active Leader
341
347
8awcmkj3sd9nv1pi77i6mdb1i worker1 Ready Active
342
348
avu80ol573rzepx8ov80ygzxz worker2 Ready Active
343
-
bxn1iivy8w7faeugpep76w50j worker3 Ready Active
349
+
bxn1iivy8w7faeugpep76w50j worker3 Ready Active
344
350
```
345
351
You see that `manager1` is Down and Unreachable and `manager2` has been elected leader. It's also easy to remove a service:
346
352
```
347
353
$ docker-machine ssh manager2 "docker service rm web"
348
354
web
349
355
```
350
356
351
-
## Cleanup
357
+
## Cleanup
352
358
There's also a [bash script](https://github.com/ManoMarks/labs/blob/master/swarm-mode/beginner-tutorial/swarm-node-vbox-teardown.sh) that will clean up your machine by removing all the Docker Machines.
353
359
354
360
```
355
-
$ ./swarm-node-vbox-teardown.sh
361
+
$ ./swarm-node-vbox-teardown.sh
356
362
Stopping "manager3"...
357
363
Stopping "manager2"...
358
364
Stopping "worker1"...
@@ -376,4 +382,4 @@ Successfully removed manager3
376
382
```
377
383
378
384
## Next steps
379
-
Next, check out the documentation on [Docker Swarm Mode](https://docs.docker.com/engine/swarm/) for more information.
385
+
Next, check out the documentation on [Docker Swarm Mode](https://docs.docker.com/engine/swarm/) for more information.
0 commit comments