Signed-off-by: Charles Smith <charles.smith@docker.com>
(cherry picked from commit 9499d5fd522e2fa31e5d0458c4eb9b420f164096)
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 |
-title = "Swarm overview" |
|
| 4 |
-description = "Docker Swarm overview" |
|
| 3 |
+title = "Swarm mode overview" |
|
| 4 |
+description = "Docker Engine swarm mode overview" |
|
| 5 | 5 |
keywords = ["docker, container, cluster, swarm"] |
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| ... | ... |
@@ -10,16 +10,16 @@ parent="engine_swarm" |
| 10 | 10 |
weight="1" |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 |
-# Docker Swarm overview |
|
| 13 |
+# Swarm mode overview |
|
| 14 | 14 |
|
| 15 |
-To use this version of Swarm, install the Docker Engine `v1.12.0-rc1` or later |
|
| 16 |
-from the [Docker releases GitHub |
|
| 15 |
+To use Docker Engine in swarm mode, install the Docker Engine `v1.12.0-rc1` or |
|
| 16 |
+later from the [Docker releases GitHub |
|
| 17 | 17 |
repository](https://github.com/docker/docker/releases). Alternatively, install |
| 18 | 18 |
the latest Docker for Mac or Docker for Windows Beta. |
| 19 | 19 |
|
| 20 |
-Docker Engine 1.12 includes Docker Swarm for natively managing a cluster of |
|
| 21 |
-Docker Engines called a Swarm. Use the Docker CLI to create a Swarm, deploy |
|
| 22 |
-application services to the Swarm, and manage the Swarm behavior. |
|
| 20 |
+Docker Engine 1.12 includes swarm mode for natively managing a cluster of |
|
| 21 |
+Docker Engines called a Swarm. Use the Docker CLI to create a swarm, deploy |
|
| 22 |
+application services to a swarm, and manage swarm behavior. |
|
| 23 | 23 |
|
| 24 | 24 |
|
| 25 | 25 |
If you’re using a Docker version prior to `v1.12.0-rc1`, see [Docker |
| ... | ... |
@@ -33,47 +33,52 @@ services. You don't need additional orchestration software to create or manage |
| 33 | 33 |
a Swarm. |
| 34 | 34 |
|
| 35 | 35 |
* **Decentralized design:** Instead of handling differentiation between node |
| 36 |
-roles at deployment time, Swarm handles any specialization at runtime. You can |
|
| 37 |
-deploy both kinds of nodes, managers and workers, using the Docker Engine. |
|
| 38 |
-This means you can build an entire Swarm from a single disk image. |
|
| 39 |
- |
|
| 40 |
-* **Declarative service model:** Swarm uses a declarative syntax to let you |
|
| 41 |
-define the desired state of the various services in your application stack. |
|
| 42 |
-For example, you might describe an application comprised of a web front end |
|
| 43 |
-service with message queueing services and a database backend. |
|
| 44 |
- |
|
| 45 |
-* **Desired state reconciliation:** Swarm constantly monitors the cluster state |
|
| 46 |
-and reconciles any differences between the actual state your expressed desired |
|
| 47 |
-state. |
|
| 36 |
+roles at deployment time, the Docker Engine handles any specialization at |
|
| 37 |
+runtime. You can deploy both kinds of nodes, managers and workers, using the |
|
| 38 |
+Docker Engine. This means you can build an entire Swarm from a single disk |
|
| 39 |
+image. |
|
| 40 |
+ |
|
| 41 |
+* **Declarative service model:** Docker Engine uses a declarative approach to |
|
| 42 |
+let you define the desired state of the various services in your application |
|
| 43 |
+stack. For example, you might describe an application comprised of a web front |
|
| 44 |
+end service with message queueing services and a database backend. |
|
| 45 |
+ |
|
| 46 |
+* **Scaling:** For each service, you can declare the number of tasks you want to |
|
| 47 |
+run. When you scale up or down, the swarm manager automatically adapts by |
|
| 48 |
+adding or removing tasks to maintain the desired state. |
|
| 49 |
+ |
|
| 50 |
+* **Desired state reconciliation:** The swarm manager node constantly monitors |
|
| 51 |
+the cluster state and reconciles any differences between the actual state your |
|
| 52 |
+expressed desired state. For example, if you set up a service to run 10 |
|
| 53 |
+replicas of a container, and a worker machine hosting two of those replicas |
|
| 54 |
+crashes, the manager will create two new replicas to replace the ones that |
|
| 55 |
+crashed. The swarm manager assigns the new replicas to workers that are |
|
| 56 |
+running and available. |
|
| 48 | 57 |
|
| 49 | 58 |
* **Multi-host networking:** You can specify an overlay network for your |
| 50 |
-application. Swarm automatically assigns addresses to the containers on the |
|
| 51 |
-overlay network when it initializes or updates the application. |
|
| 59 |
+services. The swarm manager automatically assigns addresses to the containers |
|
| 60 |
+on the overlay network when it initializes or updates the application. |
|
| 52 | 61 |
|
| 53 |
-* **Service discovery:** Swarm assigns each service a unique DNS name and load |
|
| 54 |
-balances running containers. Each Swarm has an internal DNS server that can |
|
| 55 |
-query every container in the cluster using DNS. |
|
| 62 |
+* **Service discovery:** Swarm manager nodes assign each service in the swarm a |
|
| 63 |
+unique DNS name and load balances running containers. You can query every |
|
| 64 |
+container running in the swarm through a DNS server embedded in the swarm. |
|
| 56 | 65 |
|
| 57 |
-* **Load balancing:** Using Swarm, you can expose the ports for services to an |
|
| 58 |
-external load balancer. Internally, Swarm lets you specify how to distribute |
|
| 66 |
+* **Load balancing:** You can expose the ports for services to an |
|
| 67 |
+external load balancer. Internally, the swarm lets you specify how to distribute |
|
| 59 | 68 |
service containers between nodes. |
| 60 | 69 |
|
| 61 |
-* **Secure by default:** Each node in the Swarm enforces TLS mutual |
|
| 70 |
+* **Secure by default:** Each node in the swarm enforces TLS mutual |
|
| 62 | 71 |
authentication and encryption to secure communications between itself and all |
| 63 | 72 |
other nodes. You have the option to use self-signed root certificates or |
| 64 | 73 |
certificates from a custom root CA. |
| 65 | 74 |
|
| 66 |
-* **Scaling:** For each service, you can declare the number of instances you |
|
| 67 |
-want to run. When you scale up or down, Swarm automatically adapts by adding |
|
| 68 |
-or removing instances of the service to maintain the desired state. |
|
| 69 |
- |
|
| 70 | 75 |
* **Rolling updates:** At rollout time you can apply service updates to nodes |
| 71 |
-incrementally. Swarm lets you control the delay between service deployment to |
|
| 72 |
-different sets of nodes. If anything goes wrong, you can roll-back an instance |
|
| 73 |
-of a service. |
|
| 76 |
+incrementally. The swarm manager lets you control the delay between service |
|
| 77 |
+deployment to different sets of nodes. If anything goes wrong, you can |
|
| 78 |
+roll-back a task to a previous version of the service. |
|
| 74 | 79 |
|
| 75 | 80 |
## What's next? |
| 76 |
-* Learn Swarm [key concepts](key-concepts.md). |
|
| 77 |
-* Get started with the [Swarm tutorial](swarm-tutorial/index.md). |
|
| 81 |
+* Learn swarm mode [key concepts](key-concepts.md). |
|
| 82 |
+* Get started with the [swarm mode tutorial](swarm-tutorial/index.md). |
|
| 78 | 83 |
|
| 79 | 84 |
<p style="margin-bottom:300px"> </p> |
| ... | ... |
@@ -1,86 +1,93 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 |
-title = "Swarm key concepts" |
|
| 4 |
-description = "Introducing key concepts for Docker Swarm" |
|
| 5 |
-keywords = ["docker, container, cluster, swarm"] |
|
| 3 |
+title = "Swarm mode key concepts" |
|
| 4 |
+description = "Introducing key concepts for Docker Engine swarm mode" |
|
| 5 |
+keywords = ["docker, container, cluster, swarm mode"] |
|
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| 8 |
-identifier="swarm-concepts" |
|
| 8 |
+identifier="swarm-mode-concepts" |
|
| 9 | 9 |
parent="engine_swarm" |
| 10 | 10 |
weight="2" |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 |
-# Docker Swarm key concepts |
|
| 13 |
+# Swarm mode key concepts |
|
| 14 | 14 |
|
| 15 |
-Building upon the core features of Docker Engine, Docker Swarm enables you to |
|
| 16 |
-create a Swarm of Docker Engines and orchestrate services to run in the Swarm. |
|
| 17 |
-This topic describes key concepts to help you begin using Docker Swarm. |
|
| 15 |
+This topic introduces some of the concepts unique to the cluster management and |
|
| 16 |
+orchestration features of Docker Engine 1.12. |
|
| 18 | 17 |
|
| 19 | 18 |
## Swarm |
| 20 | 19 |
|
| 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**. |
|
| 20 |
+The cluster management and orchestration features embedded in the Docker Engine |
|
| 21 |
+are built using **SwarmKit**. Engines participating in a cluster are |
|
| 22 |
+running in **swarm mode**. You enable swarm mode for the Engine by either |
|
| 23 |
+initializing a swarm or joining an existing swarm. |
|
| 24 | 24 |
|
| 25 |
-A **Swarm** is a cluster of Docker Engines where you deploy a set of application |
|
| 26 |
-services. When you deploy an application to a Swarm, you specify the desired |
|
| 27 |
-state of the services, such as which services to run and how many instances of |
|
| 28 |
-those services. The Swarm takes care of all orchestration duties required to |
|
| 29 |
-keep the services running in the desired state. |
|
| 25 |
+A **swarm** is a self-organizing cluster of Docker Engines where you deploy |
|
| 26 |
+[services](#Services-and-tasks). The Docker Engine CLI includes the commands for |
|
| 27 |
+swarm management, such as adding and removing nodes. The CLI also includes the |
|
| 28 |
+commands you need to deploy services to the swarm and manage service |
|
| 29 |
+orchestration. |
|
| 30 | 30 |
|
| 31 |
-## Node |
|
| 31 |
+When you run Docker Engine outside of swarm mode, you execute container |
|
| 32 |
+commands. When you run the Engine in swarm mode, you orchestrate services. |
|
| 32 | 33 |
|
| 33 |
-A **node** is an active instance of the Docker Engine in the Swarm. |
|
| 34 |
+## Node |
|
| 34 | 35 |
|
| 35 |
-When you deploy your application to a Swarm, **manager nodes** accept the |
|
| 36 |
-service definition that describes the Swarm's desired state. Manager nodes also |
|
| 37 |
-perform the orchestration and cluster management functions required to maintain |
|
| 38 |
-the desired state of the Swarm. For example, when a manager node receives notice |
|
| 39 |
-to deploy a web server, it dispatches the service tasks to worker nodes. |
|
| 36 |
+A **node** is an instance of the Docker Engine participating in the swarm. |
|
| 40 | 37 |
|
| 41 |
-By default the Docker Engine starts one manager node for a Swarm, but as you |
|
| 42 |
-scale you can add more managers to make the cluster more fault-tolerant. If you |
|
| 43 |
-require high availability Swarm management, Docker recommends three or five |
|
| 44 |
-Managers in your cluster. |
|
| 38 |
+To deploy your application to a swarm, you submit a service definition to a |
|
| 39 |
+**manager node**. The manager node dispatches units of work called |
|
| 40 |
+[tasks](#Services-and-tasks) to worker nodes. |
|
| 45 | 41 |
|
| 46 |
-Because Swarm manager nodes share data using Raft, there must be an odd number |
|
| 47 |
-of managers. The Swarm cluster can continue functioning in the face of up to |
|
| 48 |
-`N/2` failures where `N` is the number of manager nodes. More than five |
|
| 49 |
-managers is likely to degrade cluster performance and is not recommended. |
|
| 42 |
+Manager nodes also perform the orchestration and cluster management functions |
|
| 43 |
+required to maintain the desired state of the swarm. Manager nodes elect a single leader to conduct orchestration tasks. |
|
| 50 | 44 |
|
| 51 | 45 |
**Worker nodes** receive and execute tasks dispatched from manager nodes. By |
| 52 | 46 |
default manager nodes are also worker nodes, but you can configure managers to |
| 53 |
-be manager-only nodes. |
|
| 47 |
+be manager-only nodes. The agent notifies the manager node of the current |
|
| 48 |
+state of its assigned tasks so the manager can maintain the desired state. |
|
| 54 | 49 |
|
| 55 | 50 |
## Services and tasks |
| 56 | 51 |
|
| 57 |
-A **service** is the definition of how to run the various tasks that make up |
|
| 58 |
-your application. For example, you may create a service that deploys a Redis |
|
| 59 |
-image in your Swarm. |
|
| 60 |
- |
|
| 61 |
-A **task** is the atomic scheduling unit of Swarm. For example a task may be to |
|
| 62 |
-schedule a Redis container to run on a worker node. |
|
| 52 |
+A **service** is the definition of the tasks to execute on the worker nodes. It |
|
| 53 |
+is the central structure of the swarm system and the primary root of user |
|
| 54 |
+interaction with the swarm. |
|
| 63 | 55 |
|
| 56 |
+When you create a service, you specify which container image to use and which |
|
| 57 |
+commands to execute inside running containers. |
|
| 64 | 58 |
|
| 65 |
-## Service types |
|
| 59 |
+In the **replicated services** model, the swarm manager distributes a specific |
|
| 60 |
+number of replica tasks among the nodes based upon the scale you set in the |
|
| 61 |
+desired state. |
|
| 66 | 62 |
|
| 67 |
-For **replicated services**, Swarm deploys a specific number of replica tasks |
|
| 68 |
-based upon the scale you set in the desired state. |
|
| 63 |
+For **global services**, the swarm runs one task for the service on every |
|
| 64 |
+available node in the cluster. |
|
| 69 | 65 |
|
| 70 |
-For **global services**, Swarm runs one task for the service on every available |
|
| 71 |
-node in the cluster. |
|
| 66 |
+A **task** carries a Docker container and the commands to run inside the |
|
| 67 |
+container. It is the atomic scheduling unit of swarm. Manager nodes assign tasks |
|
| 68 |
+to worker nodes according to the number of replicas set in the service scale. |
|
| 69 |
+Once a task is assigned to a node, it cannot move to another node. It can only |
|
| 70 |
+run on the assigned node or fail. |
|
| 72 | 71 |
|
| 73 | 72 |
## Load balancing |
| 74 | 73 |
|
| 75 |
-Swarm uses **ingress load balancing** to expose the services you want to make |
|
| 76 |
-available externally to the Swarm. Swarm can automatically assign the service a |
|
| 77 |
-**PublishedPort** or you can configure a PublishedPort for the service in the |
|
| 78 |
-30000-32767 range. External components, such as cloud load balancers, can access |
|
| 79 |
-the service on the PublishedPort of any node in the cluster, even if the node is |
|
| 80 |
-not currently running the service. |
|
| 74 |
+The swarm manager uses **ingress load balancing** to expose the services you |
|
| 75 |
+want to make available externally to the swarm. The swarm manager can |
|
| 76 |
+automatically assign the service a **PublishedPort** or you can configure a |
|
| 77 |
+PublishedPort for the service in the 30000-32767 range. |
|
| 78 |
+ |
|
| 79 |
+External components, such as cloud load balancers, can access the service on the |
|
| 80 |
+PublishedPort of any node in the cluster whether or not the node is currently |
|
| 81 |
+running the task for the service. All nodes in the swarm cluster route ingress |
|
| 82 |
+connections to a running task instance. |
|
| 83 |
+ |
|
| 84 |
+Swarm mode has an internal DNS component that automatically assigns each service |
|
| 85 |
+in the swarm DNS entry. The swarm manager uses **internal load balancing** |
|
| 86 |
+distribute requests among services within the cluster based upon the DNS name of |
|
| 87 |
+the service. |
|
| 81 | 88 |
|
| 82 |
-Swarm has an internal DNS component that automatically assigns each service in |
|
| 83 |
-the Swarm DNS entry. Swarm uses **internal load balancing** distribute requests |
|
| 84 |
-among services within the cluster based upon the services' DNS name. |
|
| 89 |
+## What's next? |
|
| 90 |
+* Read the [swarm mode overview](index.md). |
|
| 91 |
+* Get started with the [swarm mode tutorial](swarm-tutorial/index.md). |
|
| 85 | 92 |
|
| 86 | 93 |
<p style="margin-bottom:300px"> </p> |
| ... | ... |
@@ -16,6 +16,6 @@ weight = 0 |
| 16 | 16 |
|
| 17 | 17 |
This section contains the following topics: |
| 18 | 18 |
|
| 19 |
-* [Docker Swarm overview](index.md) |
|
| 20 |
-* [Docker Swarm key concepts](key-concepts.md) |
|
| 21 |
-* [Getting Started with Docker Swarm](swarm-tutorial/index.md) |
|
| 19 |
+* [Docker swarm mode overview](index.md) |
|
| 20 |
+* [Docker swarm mode key concepts](key-concepts.md) |
|
| 21 |
+* [Getting Started with Docker swarm mode](swarm-tutorial/index.md) |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 |
-title = "Add nodes to the Swarm" |
|
| 4 |
-description = "Add nodes to the Swarm" |
|
| 3 |
+title = "Add nodes to the swarm" |
|
| 4 |
+description = "Add nodes to the swarm" |
|
| 5 | 5 |
keywords = ["tutorial, cluster management, swarm"] |
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| ... | ... |
@@ -11,16 +11,16 @@ weight=13 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Add nodes to the Swarm |
|
| 14 |
+# Add nodes to the swarm |
|
| 15 | 15 |
|
| 16 |
-Once you've [created a Swarm](create-swarm.md) with a manager node, you're ready |
|
| 16 |
+Once you've [created a swarm](create-swarm.md) with a manager node, you're ready |
|
| 17 | 17 |
to add worker nodes. |
| 18 | 18 |
|
| 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 | 22 |
2. Run the following command to create a worker node joined to |
| 23 |
-the existing Swarm: |
|
| 23 |
+the existing swarm: |
|
| 24 | 24 |
|
| 25 | 25 |
``` |
| 26 | 26 |
docker swarm join <MANAGER-IP>:<PORT> |
| ... | ... |
@@ -29,7 +29,7 @@ the existing Swarm: |
| 29 | 29 |
Replace `<MANAGER-IP>` with the address of the manager node and `<PORT>` |
| 30 | 30 |
with the port where the manager listens. |
| 31 | 31 |
|
| 32 |
- In the tutorial, the following command joins `worker1` to the Swarm on `manager1`: |
|
| 32 |
+ In the tutorial, the following command joins `worker1` to the swarm on `manager1`: |
|
| 33 | 33 |
|
| 34 | 34 |
``` |
| 35 | 35 |
$ docker swarm join 192.168.99.100:2377 |
| ... | ... |
@@ -50,15 +50,13 @@ the existing Swarm. |
| 50 | 50 |
the `docker node ls` command to see the worker nodes: |
| 51 | 51 |
|
| 52 | 52 |
```bash |
| 53 |
- $ docker node ls |
|
| 54 |
- |
|
| 55 |
- ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS LEADER |
|
| 56 |
-09fm6su6c24q * manager1 Accepted Ready Active Reachable Yes |
|
| 57 |
-32ljq6xijzb9 worker1 Accepted Ready Active |
|
| 58 |
-38fsncz6fal9 worker2 Accepted Ready Active |
|
| 53 |
+ ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS LEADER |
|
| 54 |
+ 03g1y59jwfg7cf99w4lt0f662 worker2 Accepted Ready Active |
|
| 55 |
+ 9j68exjopxe7wfl6yuxml7a7j worker1 Accepted Ready Active |
|
| 56 |
+ dxn1zf6l61qsb1josjja83ngz * manager1 Accepted Ready Active Reachable Yes |
|
| 59 | 57 |
``` |
| 60 | 58 |
|
| 61 |
- The `MANAGER` column identifies the manager nodes in the Swarm. The empty |
|
| 59 |
+ The `MANAGER` column identifies the manager nodes in the swarm. The empty |
|
| 62 | 60 |
status in this column for `worker1` and `worker2` identifies them as worker nodes. |
| 63 | 61 |
|
| 64 | 62 |
Swarm management commands like `docker node ls` only work on manager nodes. |
| ... | ... |
@@ -66,7 +64,7 @@ the `docker node ls` command to see the worker nodes: |
| 66 | 66 |
|
| 67 | 67 |
## What's next? |
| 68 | 68 |
|
| 69 |
-Now your Swarm consists of a manager and two worker nodes. In the next step of |
|
| 70 |
-the tutorial, you [deploy a service](deploy-service.md) to the Swarm. |
|
| 69 |
+Now your swarm consists of a manager and two worker nodes. In the next step of |
|
| 70 |
+the tutorial, you [deploy a service](deploy-service.md) to the swarm. |
|
| 71 | 71 |
|
| 72 | 72 |
<p style="margin-bottom:300px"> </p> |
| ... | ... |
@@ -1,8 +1,8 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 |
-title = "Create a Swarm" |
|
| 4 |
-description = "Initialize the Swarm" |
|
| 5 |
-keywords = ["tutorial, cluster management, swarm"] |
|
| 3 |
+title = "Create a swarm" |
|
| 4 |
+description = "Initialize the swarm" |
|
| 5 |
+keywords = ["tutorial, cluster management, swarm mode"] |
|
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| 8 | 8 |
identifier="initialize-swarm" |
| ... | ... |
@@ -11,34 +11,34 @@ weight=12 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Create a Swarm |
|
| 14 |
+# Create a swarm |
|
| 15 | 15 |
|
| 16 | 16 |
After you complete the [tutorial setup](index.md) steps, you're ready |
| 17 |
-to create a Swarm. Make sure the Docker Engine daemon is started on the host |
|
| 17 |
+to create a swarm. Make sure the Docker Engine daemon is started on the host |
|
| 18 | 18 |
machines. |
| 19 | 19 |
|
| 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 the following command to create a new Swarm: |
|
| 23 |
+2. Run the following command to create a new swarm: |
|
| 24 | 24 |
|
| 25 | 25 |
``` |
| 26 | 26 |
docker swarm init --listen-addr <MANAGER-IP>:<PORT> |
| 27 | 27 |
``` |
| 28 | 28 |
|
| 29 |
- In the tutorial, the following command creates a Swarm on the `manager1` machine: |
|
| 29 |
+ In the tutorial, the following command creates a swarm on the `manager1` machine: |
|
| 30 | 30 |
|
| 31 | 31 |
``` |
| 32 | 32 |
$ docker swarm init --listen-addr 192.168.99.100:2377 |
| 33 | 33 |
|
| 34 |
- Swarm initialized: current node (09fm6su6c24qn) is now a manager. |
|
| 34 |
+ Swarm initialized: current node (dxn1zf6l61qsb1josjja83ngz) is now a manager. |
|
| 35 | 35 |
``` |
| 36 | 36 |
|
| 37 | 37 |
The `--listen-addr` flag configures the manager node to listen on port |
| 38 |
- `2377`. The other nodes in the Swarm must be able to access the manager at |
|
| 38 |
+ `2377`. The other nodes in the swarm must be able to access the manager at |
|
| 39 | 39 |
the IP address. |
| 40 | 40 |
|
| 41 |
-3. Run `docker info` to view the current state of the Swarm: |
|
| 41 |
+3. Run `docker info` to view the current state of the swarm: |
|
| 42 | 42 |
|
| 43 | 43 |
``` |
| 44 | 44 |
$ docker info |
| ... | ... |
@@ -48,11 +48,12 @@ node. For example, the tutorial uses a machine named `manager1`. |
| 48 | 48 |
Paused: 0 |
| 49 | 49 |
Stopped: 2 |
| 50 | 50 |
...snip... |
| 51 |
- Swarm: |
|
| 52 |
- NodeID: 09fm6su6c24qn |
|
| 53 |
- IsManager: YES |
|
| 51 |
+ Swarm: active |
|
| 52 |
+ NodeID: dxn1zf6l61qsb1josjja83ngz |
|
| 53 |
+ IsManager: Yes |
|
| 54 | 54 |
Managers: 1 |
| 55 | 55 |
Nodes: 1 |
| 56 |
+ CACertHash: sha256:b7986d3baeff2f5664dfe350eec32e2383539ec1a802ba541c4eb829056b5f61 |
|
| 56 | 57 |
...snip... |
| 57 | 58 |
``` |
| 58 | 59 |
|
| ... | ... |
@@ -61,16 +62,16 @@ node. For example, the tutorial uses a machine named `manager1`. |
| 61 | 61 |
``` |
| 62 | 62 |
$ docker node ls |
| 63 | 63 |
|
| 64 |
- ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS LEADER |
|
| 65 |
-09fm6su6c24q * manager1 Accepted Ready Active Reachable Yes |
|
| 64 |
+ ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS LEADER |
|
| 65 |
+ dxn1zf6l61qsb1josjja83ngz * manager1 Accepted Ready Active Reachable Yes |
|
| 66 | 66 |
|
| 67 | 67 |
``` |
| 68 | 68 |
|
| 69 | 69 |
The `*` next to the node id, indicates that you're currently connected on |
| 70 | 70 |
this node. |
| 71 | 71 |
|
| 72 |
- Docker Swarm automatically names the node for the machine host name. The |
|
| 73 |
- tutorial covers other columns in later steps. |
|
| 72 |
+ Docker Engine swarm mode automatically names the node for the machine host |
|
| 73 |
+ name. The tutorial covers other columns in later steps. |
|
| 74 | 74 |
|
| 75 | 75 |
## What's next? |
| 76 | 76 |
|
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 | 3 |
title = "Delete the service" |
| 4 |
-description = "Remove the service on the Swarm" |
|
| 4 |
+description = "Remove the service from the swarm" |
|
| 5 | 5 |
keywords = ["tutorial, cluster management, swarm, service"] |
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| ... | ... |
@@ -11,10 +11,10 @@ weight=19 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Delete the service running on the Swarm |
|
| 14 |
+# Delete the service running on the swarm |
|
| 15 | 15 |
|
| 16 | 16 |
The remaining steps in the tutorial don't use the `helloworld` service, so now |
| 17 |
-you can delete the service from the Swarm. |
|
| 17 |
+you can delete the service from the swarm. |
|
| 18 | 18 |
|
| 19 | 19 |
1. If you haven't already, open a terminal and ssh into the machine where you |
| 20 | 20 |
run your manager node. For example, the tutorial uses a machine named |
| ... | ... |
@@ -24,11 +24,12 @@ run your manager node. For example, the tutorial uses a machine named |
| 24 | 24 |
|
| 25 | 25 |
``` |
| 26 | 26 |
$ docker service rm helloworld |
| 27 |
+ |
|
| 27 | 28 |
helloworld |
| 28 | 29 |
``` |
| 29 | 30 |
|
| 30 |
-3. Run `docker service inspect <SERVICE-ID>` to veriy that Swarm removed the |
|
| 31 |
-service. The CLI returns a message that the service is not found: |
|
| 31 |
+3. Run `docker service inspect <SERVICE-ID>` to veriy that the swarm manager |
|
| 32 |
+removed the service. The CLI returns a message that the service is not found: |
|
| 32 | 33 |
|
| 33 | 34 |
``` |
| 34 | 35 |
$ docker service inspect helloworld |
| ... | ... |
@@ -1,8 +1,8 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 | 3 |
title = "Deploy a service" |
| 4 |
-description = "Deploy the application" |
|
| 5 |
-keywords = ["tutorial, cluster management, swarm"] |
|
| 4 |
+description = "Deploy a service to the swarm" |
|
| 5 |
+keywords = ["tutorial, cluster management, swarm mode"] |
|
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| 8 | 8 |
identifier="deploy-application" |
| ... | ... |
@@ -11,10 +11,10 @@ weight=16 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Deploy a service to the Swarm |
|
| 14 |
+# Deploy a service to the swarm |
|
| 15 | 15 |
|
| 16 |
-After you [create a Swarm](create-swarm.md), you can deploy a service to the |
|
| 17 |
-Swarm. For this tutorial, you also [added worker nodes](add-nodes.md), but that |
|
| 16 |
+After you [create a swarm](create-swarm.md), you can deploy a service to the |
|
| 17 |
+swarm. For this tutorial, you also [added worker nodes](add-nodes.md), but that |
|
| 18 | 18 |
is not a requirement to deploy a service. |
| 19 | 19 |
|
| 20 | 20 |
1. Open a terminal and ssh into the machine where you run your manager node. For |
| ... | ... |
@@ -25,7 +25,7 @@ example, the tutorial uses a machine named `manager1`. |
| 25 | 25 |
```bash |
| 26 | 26 |
$ docker service create --replicas 1 --name helloworld alpine ping docker.com |
| 27 | 27 |
|
| 28 |
- 2zs4helqu64f3k3iuwywbk49w |
|
| 28 |
+ 9uk4639qpg7npwf3fn2aasksr |
|
| 29 | 29 |
``` |
| 30 | 30 |
|
| 31 | 31 |
* The `docker service create` command creates the service. |
| ... | ... |
@@ -39,12 +39,12 @@ example, the tutorial uses a machine named `manager1`. |
| 39 | 39 |
``` |
| 40 | 40 |
$ docker service ls |
| 41 | 41 |
|
| 42 |
- ID NAME REPLICAS IMAGE COMMAND |
|
| 43 |
- 2zs4helqu64f helloworld 1 alpine ping docker.com |
|
| 42 |
+ ID NAME SCALE IMAGE COMMAND |
|
| 43 |
+ 9uk4639qpg7n helloworld 1/1 alpine ping docker.com |
|
| 44 | 44 |
``` |
| 45 | 45 |
|
| 46 | 46 |
## What's next? |
| 47 | 47 |
|
| 48 |
-Now you've deployed a service to the Swarm, you're ready to [inspect the service](inspect-service.md). |
|
| 48 |
+Now you've deployed a service to the swarm, you're ready to [inspect the service](inspect-service.md). |
|
| 49 | 49 |
|
| 50 | 50 |
<p style="margin-bottom:300px"> </p> |
| ... | ... |
@@ -3,7 +3,7 @@ |
| 3 | 3 |
title = "Drain a node" |
| 4 | 4 |
description = "Drain nodes on the Swarm" |
| 5 | 5 |
keywords = ["tutorial, cluster management, swarm, service, drain"] |
| 6 |
-advisory = "rc" |
|
| 6 |
+advisory="rc" |
|
| 7 | 7 |
[menu.main] |
| 8 | 8 |
identifier="swarm-tutorial-drain-node" |
| 9 | 9 |
parent="swarm-tutorial" |
| ... | ... |
@@ -11,15 +11,15 @@ weight=21 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Drain a node on the Swarm |
|
| 14 |
+# Drain a node on the swarm |
|
| 15 | 15 |
|
| 16 | 16 |
In earlier steps of the tutorial, all the nodes have been running with `ACTIVE` |
| 17 |
-availability. The Swarm manager can assign tasks to any `ACTIVE` node, so all |
|
| 18 |
-nodes have been available to receive tasks. |
|
| 17 |
+availability. The swarm manager can assign tasks to any `ACTIVE` node, so up to |
|
| 18 |
+now all nodes have been available to receive tasks. |
|
| 19 | 19 |
|
| 20 | 20 |
Sometimes, such as planned maintenance times, you need to set a node to `DRAIN` |
| 21 |
-availabilty. `DRAIN` availabilty prevents a node from receiving new tasks |
|
| 22 |
-from the Swarm manager. It also means the manager stops tasks running on the |
|
| 21 |
+availability. `DRAIN` availability prevents a node from receiving new tasks |
|
| 22 |
+from the swarm manager. It also means the manager stops tasks running on the |
|
| 23 | 23 |
node and launches replica tasks on a node with `ACTIVE` availability. |
| 24 | 24 |
|
| 25 | 25 |
1. If you haven't already, open a terminal and ssh into the machine where you |
| ... | ... |
@@ -28,13 +28,13 @@ run your manager node. For example, the tutorial uses a machine named |
| 28 | 28 |
|
| 29 | 29 |
2. Verify that all your nodes are actively available. |
| 30 | 30 |
|
| 31 |
- ``` |
|
| 31 |
+ ```bash |
|
| 32 | 32 |
$ docker node ls |
| 33 | 33 |
|
| 34 |
- ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS LEADER |
|
| 35 |
- 1x2bldyhie1cj worker1 Accepted Ready Active |
|
| 36 |
- 1y3zuia1z224i worker2 Accepted Ready Active |
|
| 37 |
- 2p5bfd34mx4op * manager1 Accepted Ready Active Reachable Yes |
|
| 34 |
+ ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS LEADER |
|
| 35 |
+ 1bcef6utixb0l0ca7gxuivsj0 worker2 Accepted Ready Active |
|
| 36 |
+ 38ciaotwjuritcdtn9npbnkuz worker1 Accepted Ready Active |
|
| 37 |
+ e216jshn25ckzbvmwlnh5jr3g * manager1 Accepted Ready Active Reachable Yes |
|
| 38 | 38 |
``` |
| 39 | 39 |
|
| 40 | 40 |
2. If you aren't still running the `redis` service from the [rolling |
| ... | ... |
@@ -43,22 +43,22 @@ update](rolling-update.md) tutorial, start it now: |
| 43 | 43 |
```bash |
| 44 | 44 |
$ docker service create --replicas 3 --name redis --update-delay 10s --update-parallelism 1 redis:3.0.6 |
| 45 | 45 |
|
| 46 |
- 69uh57k8o03jtqj9uvmteodbb |
|
| 46 |
+ c5uo6kdmzpon37mgj9mwglcfw |
|
| 47 | 47 |
``` |
| 48 | 48 |
|
| 49 | 49 |
3. Run `docker service tasks redis` to see how the Swarm manager assigned the |
| 50 | 50 |
tasks to different nodes: |
| 51 | 51 |
|
| 52 |
- ``` |
|
| 52 |
+ ```bash |
|
| 53 | 53 |
$ docker service tasks redis |
| 54 | 54 |
|
| 55 | 55 |
ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE |
| 56 |
- 3wfqsgxecktpwoyj2zjcrcn4r redis.1 redis redis:3.0.6 RUNNING 13 minutes RUNNING worker2 |
|
| 57 |
- 8lcm041z3v80w0gdkczbot0gg redis.2 redis redis:3.0.6 RUNNING 13 minutes RUNNING worker1 |
|
| 58 |
- d48skceeph9lkz4nbttig1z4a redis.3 redis redis:3.0.6 RUNNING 12 minutes RUNNING manager1 |
|
| 56 |
+ 7q92v0nr1hcgts2amcjyqg3pq redis.1 redis redis:3.0.6 Running 26 seconds Running manager1 |
|
| 57 |
+ 7h2l8h3q3wqy5f66hlv9ddmi6 redis.2 redis redis:3.0.6 Running 26 seconds Running worker1 |
|
| 58 |
+ 9bg7cezvedmkgg6c8yzvbhwsd redis.3 redis redis:3.0.6 Running 26 seconds Running worker2 |
|
| 59 | 59 |
``` |
| 60 | 60 |
|
| 61 |
- In this case the Swarm manager distributed one task to each node. You may |
|
| 61 |
+ In this case the swarm manager distributed one task to each node. You may |
|
| 62 | 62 |
see the tasks distributed differently among the nodes in your environment. |
| 63 | 63 |
|
| 64 | 64 |
4. Run `docker node update --availability drain <NODE-ID>` to drain a node that |
| ... | ... |
@@ -66,18 +66,20 @@ had a task assigned to it: |
| 66 | 66 |
|
| 67 | 67 |
```bash |
| 68 | 68 |
docker node update --availability drain worker1 |
| 69 |
+ |
|
| 69 | 70 |
worker1 |
| 70 | 71 |
``` |
| 71 | 72 |
|
| 72 | 73 |
5. Inspect the node to check its availability: |
| 73 | 74 |
|
| 74 |
- ``` |
|
| 75 |
+ ```bash |
|
| 75 | 76 |
$ docker node inspect --pretty worker1 |
| 76 |
- ID: 1x2bldyhie1cj |
|
| 77 |
+ |
|
| 78 |
+ ID: 38ciaotwjuritcdtn9npbnkuz |
|
| 77 | 79 |
Hostname: worker1 |
| 78 | 80 |
Status: |
| 79 |
- State: READY |
|
| 80 |
- Availability: DRAIN |
|
| 81 |
+ State: Ready |
|
| 82 |
+ Availability: Drain |
|
| 81 | 83 |
...snip... |
| 82 | 84 |
``` |
| 83 | 85 |
|
| ... | ... |
@@ -86,11 +88,13 @@ had a task assigned to it: |
| 86 | 86 |
6. Run `docker service tasks redis` to see how the Swarm manager updated the |
| 87 | 87 |
task assignments for the `redis` service: |
| 88 | 88 |
|
| 89 |
- ``` |
|
| 90 |
- ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE |
|
| 91 |
- 3wfqsgxecktpwoyj2zjcrcn4r redis.1 redis redis:3.0.6 RUNNING 26 minutes RUNNING worker2 |
|
| 92 |
- ah7o4u5upostw3up1ns9vbqtc redis.2 redis redis:3.0.6 RUNNING 9 minutes RUNNING manager1 |
|
| 93 |
- d48skceeph9lkz4nbttig1z4a redis.3 redis redis:3.0.6 RUNNING 26 minutes RUNNING manager1 |
|
| 89 |
+ ```bash |
|
| 90 |
+ $ docker service tasks redis |
|
| 91 |
+ |
|
| 92 |
+ ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE |
|
| 93 |
+ 7q92v0nr1hcgts2amcjyqg3pq redis.1 redis redis:3.0.6 Running 4 minutes Running manager1 |
|
| 94 |
+ b4hovzed7id8irg1to42egue8 redis.2 redis redis:3.0.6 Running About a minute Running worker2 |
|
| 95 |
+ 9bg7cezvedmkgg6c8yzvbhwsd redis.3 redis redis:3.0.6 Running 4 minutes Running worker2 |
|
| 94 | 96 |
``` |
| 95 | 97 |
|
| 96 | 98 |
The Swarm manager maintains the desired state by ending the task on a node |
| ... | ... |
@@ -102,18 +106,20 @@ drained node to an active state: |
| 102 | 102 |
|
| 103 | 103 |
```bash |
| 104 | 104 |
$ docker node update --availability active worker1 |
| 105 |
+ |
|
| 105 | 106 |
worker1 |
| 106 | 107 |
``` |
| 107 | 108 |
|
| 108 | 109 |
8. Inspect the node to see the updated state: |
| 109 | 110 |
|
| 110 |
- ``` |
|
| 111 |
+ ```bash |
|
| 111 | 112 |
$ docker node inspect --pretty worker1 |
| 112 |
- ID: 1x2bldyhie1cj |
|
| 113 |
+ |
|
| 114 |
+ ID: 38ciaotwjuritcdtn9npbnkuz |
|
| 113 | 115 |
Hostname: worker1 |
| 114 | 116 |
Status: |
| 115 |
- State: READY |
|
| 116 |
- Availability: ACTIVE |
|
| 117 |
+ State: Ready |
|
| 118 |
+ Availability: Active |
|
| 117 | 119 |
...snip... |
| 118 | 120 |
``` |
| 119 | 121 |
|
| ... | ... |
@@ -1,8 +1,8 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 | 3 |
title = "Set up for the tutorial" |
| 4 |
-description = "Getting Started tutorial for Docker Swarm" |
|
| 5 |
-keywords = ["tutorial, cluster management, swarm"] |
|
| 4 |
+description = "Getting Started tutorial for Docker Engine swarm mode" |
|
| 5 |
+keywords = ["tutorial, cluster management, swarm mode"] |
|
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| 8 | 8 |
identifier="tutorial-setup" |
| ... | ... |
@@ -11,15 +11,18 @@ weight=11 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Getting Started with Docker Swarm |
|
| 14 |
+# Getting started with swarm mode |
|
| 15 | 15 |
|
| 16 |
-This tutorial introduces you to the key features of Docker Swarm. It guides you |
|
| 17 |
-through the following activities: |
|
| 16 |
+This tutorial introduces you to the features of Docker Engine Swarm mode. You |
|
| 17 |
+may want to familiarize yourself with the [key concepts](../key-concepts.md) |
|
| 18 |
+before you begin. |
|
| 18 | 19 |
|
| 19 |
-* initializing a cluster of Docker Engines called a Swarm |
|
| 20 |
-* adding nodes to the Swarm |
|
| 21 |
-* deploying application services to the Swarm |
|
| 22 |
-* managing the Swarm once you have everything running |
|
| 20 |
+The tutorial guides you through the following activities: |
|
| 21 |
+ |
|
| 22 |
+* initializing a cluster of Docker Engines in swarm mode |
|
| 23 |
+* adding nodes to the swarm |
|
| 24 |
+* deploying application services to the swarm |
|
| 25 |
+* managing the swarm once you have everything running |
|
| 23 | 26 |
|
| 24 | 27 |
This tutorial uses Docker Engine CLI commands entered on the command line of a |
| 25 | 28 |
terminal window. You should be able to install Docker on networked machines and |
| ... | ... |
@@ -28,6 +31,7 @@ be comfortable running commands in the shell of your choice. |
| 28 | 28 |
If you’re brand new to Docker, see [About Docker Engine](../../index.md). |
| 29 | 29 |
|
| 30 | 30 |
## Set up |
| 31 |
+ |
|
| 31 | 32 |
To run this tutorial, you need the following: |
| 32 | 33 |
|
| 33 | 34 |
* [three networked host machines](#three-networked-host-machines) |
| ... | ... |
@@ -37,7 +41,7 @@ To run this tutorial, you need the following: |
| 37 | 37 |
|
| 38 | 38 |
### Three networked host machines |
| 39 | 39 |
|
| 40 |
-The tutorial uses three networked host machines as nodes in the Swarm. These can |
|
| 40 |
+The tutorial uses three networked host machines as nodes in the swarm. These can |
|
| 41 | 41 |
be virtual machines on your PC, in a data center, or on a cloud service |
| 42 | 42 |
provider. This tutorial uses the following machine names: |
| 43 | 43 |
|
| ... | ... |
@@ -47,10 +51,13 @@ provider. This tutorial uses the following machine names: |
| 47 | 47 |
|
| 48 | 48 |
### Docker Engine 1.12 or later |
| 49 | 49 |
|
| 50 |
-You must install Docker Engine on each one of the host machines. To use this |
|
| 51 |
-version of Swarm, install the Docker Engine `v1.12.0-rc1` or later from the |
|
| 52 |
-[Docker releases GitHub repository](https://github.com/docker/docker/releases). |
|
| 53 |
-Alternatively, install the latest Docker for Mac or Docker for Windows Beta. |
|
| 50 |
+You must install Docker Engine on each one of the host machines. To use swarm |
|
| 51 |
+mode, install the Docker Engine `v1.12.0-rc1` or later from the [Docker releases |
|
| 52 |
+GitHub repository](https://github.com/docker/docker/releases). Alternatively, |
|
| 53 |
+install the latest Docker for Mac or Docker for Windows Beta. |
|
| 54 |
+ |
|
| 55 |
+>**Advisory**: Some multi-node features may not work for Docker for Mac Beta and |
|
| 56 |
+Docker for Windows Beta. We're working on the multi-node features for GA. |
|
| 54 | 57 |
|
| 55 | 58 |
Verify that the Docker Engine daemon is running on each of the machines. |
| 56 | 59 |
|
| ... | ... |
@@ -64,9 +71,9 @@ Verify that the Docker Engine daemon is running on each of the machines. |
| 64 | 64 |
### The IP address of the manager machine |
| 65 | 65 |
|
| 66 | 66 |
The IP address must be assigned to an a network interface available to the host |
| 67 |
-operating system. All nodes in the Swarm must be able to access the manager at the IP address. |
|
| 67 |
+operating system. All nodes in the swarm must be able to access the manager at the IP address. |
|
| 68 | 68 |
|
| 69 |
->**Tip**: You can run `ifconfig` on Linux or Mac OSX to see a list of the |
|
| 69 |
+>**Tip**: You can run `ifconfig` on Linux or Mac OS X to see a list of the |
|
| 70 | 70 |
available network interfaces. |
| 71 | 71 |
|
| 72 | 72 |
The tutorial uses `manager1` : `192.168.99.100`. |
| ... | ... |
@@ -82,6 +89,6 @@ The tutorial uses `manager1` : `192.168.99.100`. |
| 82 | 82 |
|
| 83 | 83 |
## What's next? |
| 84 | 84 |
|
| 85 |
-After you have set up your environment, you're ready to [create a Swarm](create-swarm.md). |
|
| 85 |
+After you have set up your environment, you're ready to [create a swarm](create-swarm.md). |
|
| 86 | 86 |
|
| 87 | 87 |
<p style="margin-bottom:300px"> </p> |
| ... | ... |
@@ -2,7 +2,7 @@ |
| 2 | 2 |
+++ |
| 3 | 3 |
title = "Inspect the service" |
| 4 | 4 |
description = "Inspect the application" |
| 5 |
-keywords = ["tutorial, cluster management, swarm"] |
|
| 5 |
+keywords = ["tutorial, cluster management, swarm mode"] |
|
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| 8 | 8 |
identifier="inspect-application" |
| ... | ... |
@@ -11,10 +11,10 @@ weight=17 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Inspect a service on the Swarm |
|
| 14 |
+# Inspect a service on the swarm |
|
| 15 | 15 |
|
| 16 |
-When you have [deployed a service](deploy-service.md) to your Swarm, you can use |
|
| 17 |
-the Docker CLI to see details about the service running in the Swarm. |
|
| 16 |
+When you have [deployed a service](deploy-service.md) to your swarm, you can use |
|
| 17 |
+the Docker CLI to see details about the service running in the swarm. |
|
| 18 | 18 |
|
| 19 | 19 |
1. If you haven't already, open a terminal and ssh into the machine where you |
| 20 | 20 |
run your manager node. For example, the tutorial uses a machine named |
| ... | ... |
@@ -28,17 +28,17 @@ about a service in an easily readable format. |
| 28 | 28 |
``` |
| 29 | 29 |
$ docker service inspect --pretty helloworld |
| 30 | 30 |
|
| 31 |
- ID: 2zs4helqu64f3k3iuwywbk49w |
|
| 31 |
+ ID: 9uk4639qpg7npwf3fn2aasksr |
|
| 32 | 32 |
Name: helloworld |
| 33 | 33 |
Mode: REPLICATED |
| 34 |
- Scale: 1 |
|
| 34 |
+ Replicas: 1 |
|
| 35 | 35 |
Placement: |
| 36 | 36 |
Strategy: SPREAD |
| 37 | 37 |
UpdateConfig: |
| 38 | 38 |
Parallelism: 1 |
| 39 | 39 |
ContainerSpec: |
| 40 | 40 |
Image: alpine |
| 41 |
- Command: ping docker.com |
|
| 41 |
+ Args: ping docker.com |
|
| 42 | 42 |
``` |
| 43 | 43 |
|
| 44 | 44 |
>**Tip**: To return the service details in json format, run the same command |
| ... | ... |
@@ -48,36 +48,43 @@ about a service in an easily readable format. |
| 48 | 48 |
$ docker service inspect helloworld |
| 49 | 49 |
[ |
| 50 | 50 |
{
|
| 51 |
- "ID": "2zs4helqu64f3k3iuwywbk49w", |
|
| 51 |
+ "ID": "9uk4639qpg7npwf3fn2aasksr", |
|
| 52 | 52 |
"Version": {
|
| 53 |
- "Index": 16264 |
|
| 53 |
+ "Index": 418 |
|
| 54 | 54 |
}, |
| 55 |
- "CreatedAt": "2016-06-06T17:41:11.509146705Z", |
|
| 56 |
- "UpdatedAt": "2016-06-06T17:41:11.510426385Z", |
|
| 55 |
+ "CreatedAt": "2016-06-16T21:57:11.622222327Z", |
|
| 56 |
+ "UpdatedAt": "2016-06-16T21:57:11.622222327Z", |
|
| 57 | 57 |
"Spec": {
|
| 58 | 58 |
"Name": "helloworld", |
| 59 |
- "ContainerSpec": {
|
|
| 60 |
- "Image": "alpine", |
|
| 61 |
- "Command": [ |
|
| 62 |
- "ping", |
|
| 63 |
- "docker.com" |
|
| 64 |
- ], |
|
| 59 |
+ "TaskTemplate": {
|
|
| 60 |
+ "ContainerSpec": {
|
|
| 61 |
+ "Image": "alpine", |
|
| 62 |
+ "Args": [ |
|
| 63 |
+ "ping", |
|
| 64 |
+ "docker.com" |
|
| 65 |
+ ] |
|
| 66 |
+ }, |
|
| 65 | 67 |
"Resources": {
|
| 66 | 68 |
"Limits": {},
|
| 67 | 69 |
"Reservations": {}
|
| 68 |
- } |
|
| 70 |
+ }, |
|
| 71 |
+ "RestartPolicy": {
|
|
| 72 |
+ "Condition": "any", |
|
| 73 |
+ "MaxAttempts": 0 |
|
| 74 |
+ }, |
|
| 75 |
+ "Placement": {}
|
|
| 69 | 76 |
}, |
| 70 | 77 |
"Mode": {
|
| 71 | 78 |
"Replicated": {
|
| 72 |
- "Instances": 1 |
|
| 79 |
+ "Replicas": 1 |
|
| 73 | 80 |
} |
| 74 | 81 |
}, |
| 75 |
- "RestartPolicy": {},
|
|
| 76 |
- "Placement": {},
|
|
| 77 | 82 |
"UpdateConfig": {
|
| 78 | 83 |
"Parallelism": 1 |
| 79 | 84 |
}, |
| 80 |
- "EndpointSpec": {}
|
|
| 85 |
+ "EndpointSpec": {
|
|
| 86 |
+ "Mode": "vip" |
|
| 87 |
+ } |
|
| 81 | 88 |
}, |
| 82 | 89 |
"Endpoint": {
|
| 83 | 90 |
"Spec": {}
|
| ... | ... |
@@ -92,20 +99,20 @@ service: |
| 92 | 92 |
``` |
| 93 | 93 |
$ docker service tasks helloworld |
| 94 | 94 |
|
| 95 |
- ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE |
|
| 96 |
- 1n6wif51j0w840udalgw6hphg helloworld.1 helloworld alpine RUNNING RUNNING 19 minutes manager1 |
|
| 95 |
+ ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE |
|
| 96 |
+ 8p1vev3fq5zm0mi8g0as41w35 helloworld.1 helloworld alpine Running 3 minutes Running worker2 |
|
| 97 | 97 |
``` |
| 98 | 98 |
|
| 99 | 99 |
In this case, the one instance of the `helloworld` service is running on the |
| 100 |
- `manager1` node. Manager nodes in a Swarm can execute tasks just like worker |
|
| 101 |
- nodes. |
|
| 100 |
+ `worker2` node. You may see the service running on your manager node. By |
|
| 101 |
+ default, manager nodes in a Swarm can execute tasks just like worker nodes. |
|
| 102 | 102 |
|
| 103 | 103 |
Swarm also shows you the `DESIRED STATE` and `LAST STATE` of the service |
| 104 | 104 |
task so you can see if tasks are running according to the service |
| 105 | 105 |
definition. |
| 106 | 106 |
|
| 107 |
-4. Run `docker ps` on the node where the instance of the service is running to |
|
| 108 |
-see the service container. |
|
| 107 |
+4. Run `docker ps` on the node where the task is running to see details about |
|
| 108 |
+the container for the task. |
|
| 109 | 109 |
|
| 110 | 110 |
>**Tip**: If `helloworld` is running on a node other than your manager node, |
| 111 | 111 |
you must ssh to that node. |
| ... | ... |
@@ -114,12 +121,12 @@ see the service container. |
| 114 | 114 |
$docker ps |
| 115 | 115 |
|
| 116 | 116 |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 117 |
- a0b6c02868ca alpine:latest "ping docker.com" 12 minutes ago Up 12 minutes helloworld.1.1n6wif51j0w840udalgw6hphg |
|
| 117 |
+ e609dde94e47 alpine:latest "ping docker.com" 3 minutes ago Up 3 minutes helloworld.1.8p1vev3fq5zm0mi8g0as41w35 |
|
| 118 | 118 |
``` |
| 119 | 119 |
|
| 120 | 120 |
## What's next? |
| 121 | 121 |
|
| 122 | 122 |
Next, you can [change the scale](scale-service.md) for the service running in |
| 123 |
-the Swarm. |
|
| 123 |
+the swarm. |
|
| 124 | 124 |
|
| 125 | 125 |
<p style="margin-bottom:300px"> </p> |
| ... | ... |
@@ -11,11 +11,11 @@ weight=10 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Docker Swarm getting started tutorial |
|
| 14 |
+# Docker Engine swarm mode getting started tutorial |
|
| 15 | 15 |
|
| 16 | 16 |
## TOC |
| 17 | 17 |
|
| 18 | 18 |
- [Begin the tutorial](index.md) - Setup your environment to prepare |
| 19 |
- to build a Swarm. |
|
| 19 |
+ to build a swarm. |
|
| 20 | 20 |
|
| 21 | 21 |
<p style="margin-bottom:300px"> </p> |
| ... | ... |
@@ -14,20 +14,21 @@ weight=20 |
| 14 | 14 |
# Apply rolling updates to a service |
| 15 | 15 |
|
| 16 | 16 |
In a previous step of the tutorial, you [scaled](scale-service.md) the number of |
| 17 |
-instances of a service. In this part of the tutorial, you deploy a new Redis |
|
| 18 |
-service and upgrade the service using rolling updates. |
|
| 17 |
+instances of a service. In this part of the tutorial, you deploy a service based |
|
| 18 |
+on the Redis 3.0.6 container image. Then you upgrade the service to use the |
|
| 19 |
+Redis 3.0.7 container image using rolling updates. |
|
| 19 | 20 |
|
| 20 | 21 |
1. If you haven't already, open a terminal and ssh into the machine where you |
| 21 | 22 |
run your manager node. For example, the tutorial uses a machine named |
| 22 | 23 |
`manager1`. |
| 23 | 24 |
|
| 24 |
-2. Deploy Redis 3.0.6 to all nodes in the Swarm and configure |
|
| 25 |
-the swarm to update one node every 10 seconds: |
|
| 25 |
+2. Deploy Redis 3.0.6 to the swarm and configure the swarm to update one node |
|
| 26 |
+every 10 seconds: |
|
| 26 | 27 |
|
| 27 | 28 |
```bash |
| 28 | 29 |
$ docker service create --replicas 3 --name redis --update-delay 10s --update-parallelism 1 redis:3.0.6 |
| 29 | 30 |
|
| 30 |
- 8m228injfrhdym2zvzhl9k3l0 |
|
| 31 |
+ 0u6a4s31ybk7yw2wyvtikmu50 |
|
| 31 | 32 |
``` |
| 32 | 33 |
|
| 33 | 34 |
You configure the rolling update policy at service deployment time. |
| ... | ... |
@@ -42,13 +43,13 @@ the swarm to update one node every 10 seconds: |
| 42 | 42 |
|
| 43 | 43 |
3. Inspect the `redis` service: |
| 44 | 44 |
|
| 45 |
- ``` |
|
| 45 |
+ ```bash |
|
| 46 | 46 |
$ docker service inspect redis --pretty |
| 47 | 47 |
|
| 48 |
- ID: 75kcmhuf8mif4a07738wttmgl |
|
| 48 |
+ ID: 0u6a4s31ybk7yw2wyvtikmu50 |
|
| 49 | 49 |
Name: redis |
| 50 | 50 |
Mode: REPLICATED |
| 51 |
- Scale: 3 |
|
| 51 |
+ Replicas: 3 |
|
| 52 | 52 |
Placement: |
| 53 | 53 |
Strategy: SPREAD |
| 54 | 54 |
UpdateConfig: |
| ... | ... |
@@ -58,8 +59,8 @@ the swarm to update one node every 10 seconds: |
| 58 | 58 |
Image: redis:3.0.6 |
| 59 | 59 |
``` |
| 60 | 60 |
|
| 61 |
-4. Now you can update the container image for `redis`. Swarm applies the update |
|
| 62 |
-to nodes according to the `UpdateConfig` policy: |
|
| 61 |
+4. Now you can update the container image for `redis`. The swarm manager |
|
| 62 |
+applies the update to nodes according to the `UpdateConfig` policy: |
|
| 63 | 63 |
|
| 64 | 64 |
```bash |
| 65 | 65 |
$ docker service update --image redis:3.0.7 redis |
| ... | ... |
@@ -69,37 +70,37 @@ to nodes according to the `UpdateConfig` policy: |
| 69 | 69 |
5. Run `docker service inspect --pretty redis` to see the new image in the |
| 70 | 70 |
desired state: |
| 71 | 71 |
|
| 72 |
- ``` |
|
| 72 |
+ ```bash |
|
| 73 | 73 |
docker service inspect --pretty redis |
| 74 | 74 |
|
| 75 |
- ID: 1yrcci9v8zj6cokua2eishlob |
|
| 75 |
+ ID: 0u6a4s31ybk7yw2wyvtikmu50 |
|
| 76 | 76 |
Name: redis |
| 77 | 77 |
Mode: REPLICATED |
| 78 |
- Scale: 3 |
|
| 78 |
+ Replicas: 3 |
|
| 79 | 79 |
Placement: |
| 80 | 80 |
Strategy: SPREAD |
| 81 | 81 |
UpdateConfig: |
| 82 | 82 |
Parallelism: 1 |
| 83 | 83 |
Delay: 10s |
| 84 |
- ContainerSpec: |
|
| 85 |
- Image: redis:3.0.7 |
|
| 84 |
+ ContainerSpec: |
|
| 85 |
+ Image: redis:3.0.7 |
|
| 86 | 86 |
``` |
| 87 | 87 |
|
| 88 | 88 |
6. Run `docker service tasks <TASK-ID>` to watch the rolling update: |
| 89 | 89 |
|
| 90 |
- ``` |
|
| 90 |
+ ```bash |
|
| 91 | 91 |
$ docker service tasks redis |
| 92 | 92 |
|
| 93 |
- ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE |
|
| 94 |
- 5409nu4crb0smamziqwuug67u redis.1 redis redis:3.0.7 RUNNING RUNNING 21 seconds worker2 |
|
| 95 |
- b8ezq58zugcg1trk8k7jrq9ym redis.2 redis redis:3.0.7 RUNNING RUNNING 1 seconds worker1 |
|
| 96 |
- cgdcbipxnzx0y841vysiafb64 redis.3 redis redis:3.0.7 RUNNING RUNNING 11 seconds worker1 |
|
| 93 |
+ ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE |
|
| 94 |
+ dos1zffgeofhagnve8w864fco redis.1 redis redis:3.0.7 Running 37 seconds Running worker1 |
|
| 95 |
+ 9l3i4j85517skba5o7tn5m8g0 redis.2 redis redis:3.0.7 Running About a minute Running worker2 |
|
| 96 |
+ egiuiqpzrdbxks3wxgn8qib1g redis.3 redis redis:3.0.7 Running 48 seconds Running worker1 |
|
| 97 | 97 |
``` |
| 98 | 98 |
|
| 99 | 99 |
Before Swarm updates all of the tasks, you can see that some are running |
| 100 | 100 |
`redis:3.0.6` while others are running `redis:3.0.7`. The output above shows |
| 101 | 101 |
the state once the rolling updates are done. You can see that each instances |
| 102 |
- entered the `RUNNING` state in 10 second increments. |
|
| 102 |
+ entered the `RUNNING` state in approximately 10 second increments. |
|
| 103 | 103 |
|
| 104 | 104 |
Next, learn about how to [drain a node](drain-node.md) in the Swarm. |
| 105 | 105 |
|
| ... | ... |
@@ -1,8 +1,8 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 | 3 |
title = "Scale the service" |
| 4 |
-description = "Scale the service running in the Swarm" |
|
| 5 |
-keywords = ["tutorial, cluster management, swarm, scale"] |
|
| 4 |
+description = "Scale the service running in the swarm" |
|
| 5 |
+keywords = ["tutorial, cluster management, swarm mode, scale"] |
|
| 6 | 6 |
advisory = "rc" |
| 7 | 7 |
[menu.main] |
| 8 | 8 |
identifier="swarm-tutorial-scale-service" |
| ... | ... |
@@ -11,29 +11,29 @@ weight=18 |
| 11 | 11 |
+++ |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 |
-# Scale the service in the Swarm |
|
| 14 |
+# Scale the service in the swarm |
|
| 15 | 15 |
|
| 16 |
-Once you have [deployed a service](deploy-service.md) to a Swarm, you are ready |
|
| 16 |
+Once you have [deployed a service](deploy-service.md) to a swarm, you are ready |
|
| 17 | 17 |
to use the Docker CLI to scale the number of service tasks in |
| 18 |
-the Swarm. |
|
| 18 |
+the swarm. |
|
| 19 | 19 |
|
| 20 | 20 |
1. If you haven't already, open a terminal and ssh into the machine where you |
| 21 | 21 |
run your manager node. For example, the tutorial uses a machine named |
| 22 | 22 |
`manager1`. |
| 23 | 23 |
|
| 24 | 24 |
2. Run the following command to change the desired state of the |
| 25 |
-service runing in the Swarm: |
|
| 25 |
+service running in the swarm: |
|
| 26 | 26 |
|
| 27 | 27 |
```bash |
| 28 |
- $ docker service update --replicas <NUMBER-OF-TASKS> <SERVICE-ID> |
|
| 28 |
+ $ docker service scale <SERVICE-ID>=<NUMBER-OF-TASKS> |
|
| 29 | 29 |
``` |
| 30 | 30 |
|
| 31 |
- The `--replicas` flag indicates the number of tasks you want in the new |
|
| 32 |
- desired state. For example: |
|
| 31 |
+ For example: |
|
| 33 | 32 |
|
| 34 | 33 |
```bash |
| 35 |
- $ docker service update --replicas 5 helloworld |
|
| 36 |
- helloworld |
|
| 34 |
+ $ docker service scale helloworld=5 |
|
| 35 |
+ |
|
| 36 |
+ helloworld scaled to 5 |
|
| 37 | 37 |
``` |
| 38 | 38 |
|
| 39 | 39 |
3. Run `docker service tasks <SERVICE-ID>` to see the updated task list: |
| ... | ... |
@@ -41,17 +41,17 @@ service runing in the Swarm: |
| 41 | 41 |
``` |
| 42 | 42 |
$ docker service tasks helloworld |
| 43 | 43 |
|
| 44 |
- ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE |
|
| 45 |
- 1n6wif51j0w840udalgw6hphg helloworld.1 helloworld alpine RUNNING RUNNING 2 minutes manager1 |
|
| 46 |
- dfhsosk00wxfb7j0cazp3fmhy helloworld.2 helloworld alpine RUNNING RUNNING 15 seconds worker2 |
|
| 47 |
- 6cbedbeywo076zn54fnwc667a helloworld.3 helloworld alpine RUNNING RUNNING 15 seconds worker1 |
|
| 48 |
- 7w80cafrry7asls96lm2tmwkz helloworld.4 helloworld alpine RUNNING RUNNING 10 seconds worker1 |
|
| 49 |
- bn67kh76crn6du22ve2enqg5j helloworld.5 helloworld alpine RUNNING RUNNING 10 seconds manager1 |
|
| 44 |
+ ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE |
|
| 45 |
+ 8p1vev3fq5zm0mi8g0as41w35 helloworld.1 helloworld alpine Running 7 minutes Running worker2 |
|
| 46 |
+ c7a7tcdq5s0uk3qr88mf8xco6 helloworld.2 helloworld alpine Running 24 seconds Running worker1 |
|
| 47 |
+ 6crl09vdcalvtfehfh69ogfb1 helloworld.3 helloworld alpine Running 24 seconds Running worker1 |
|
| 48 |
+ auky6trawmdlcne8ad8phb0f1 helloworld.4 helloworld alpine Running 24 seconds Accepted manager1 |
|
| 49 |
+ ba19kca06l18zujfwxyc5lkyn helloworld.5 helloworld alpine Running 24 seconds Running worker2 |
|
| 50 | 50 |
``` |
| 51 | 51 |
|
| 52 |
- You can see that Swarm has created 4 new tasks to scale to a total of 5 |
|
| 52 |
+ You can see that swarm has created 4 new tasks to scale to a total of 5 |
|
| 53 | 53 |
running instances of Alpine Linux. The tasks are distributed between the |
| 54 |
- three nodes of the Swarm. Two are running on `manager1`. |
|
| 54 |
+ three nodes of the swarm. Two are running on `manager1`. |
|
| 55 | 55 |
|
| 56 | 56 |
4. Run `docker ps` to see the containers running on the node where you're |
| 57 | 57 |
connected. The following example shows the tasks running on `manager1`: |
| ... | ... |
@@ -60,8 +60,7 @@ connected. The following example shows the tasks running on `manager1`: |
| 60 | 60 |
$ docker ps |
| 61 | 61 |
|
| 62 | 62 |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 63 |
- 910669d5e188 alpine:latest "ping docker.com" 10 seconds ago Up 10 seconds helloworld.5.bn67kh76crn6du22ve2enqg5j |
|
| 64 |
- a0b6c02868ca alpine:latest "ping docker.com" 2 minutes ago Up 2 minutes helloworld.1.1n6wif51j0w840udalgw6hphg |
|
| 63 |
+ 528d68040f95 alpine:latest "ping docker.com" About a minute ago Up About a minute helloworld.4.auky6trawmdlcne8ad8phb0f1 |
|
| 65 | 64 |
``` |
| 66 | 65 |
|
| 67 | 66 |
If you want to see the containers running on other nodes, you can ssh into |