Signed-off-by: Charles Smith <charles.smith@docker.com>
| ... | ... |
@@ -29,7 +29,6 @@ update delay: |
| 29 | 29 |
--replicas 3 \ |
| 30 | 30 |
--name redis \ |
| 31 | 31 |
--update-delay 10s \ |
| 32 |
- --update-parallelism 1 \ |
|
| 33 | 32 |
redis:3.0.6 |
| 34 | 33 |
|
| 35 | 34 |
0u6a4s31ybk7yw2wyvtikmu50 |
| ... | ... |
@@ -37,18 +36,21 @@ update delay: |
| 37 | 37 |
|
| 38 | 38 |
You configure the rolling update policy at service deployment time. |
| 39 | 39 |
|
| 40 |
- The `--update-parallelism` flag configures the number of service tasks that |
|
| 41 |
- the scheduler can update simultaneously. When updates to individual tasks |
|
| 42 |
- return a state of `RUNNING` or `FAILED`, the scheduler schedules another |
|
| 43 |
- task to update until all tasks are updated. |
|
| 44 |
- |
|
| 45 | 40 |
The `--update-delay` flag configures the time delay between updates to a |
| 46 |
- service task or sets of tasks. |
|
| 41 |
+ service task or sets of tasks. You can describe the time `T` as a |
|
| 42 |
+ combination of the number of seconds `Ts`, minutes `Tm`, or hours `Th`. So |
|
| 43 |
+ `10m30s` indicates a 10 minute 30 second delay. |
|
| 47 | 44 |
|
| 48 |
- You can describe the time `T` as a combination of the number of seconds |
|
| 49 |
- `Ts`, minutes `Tm`, or hours `Th`. So `10m30s` indicates a 10 minute 30 |
|
| 50 |
- second delay. |
|
| 45 |
+ By default the scheduler updates 1 task at a time. You can pass the |
|
| 46 |
+ `--update-parallelism` flag to configure the maximum number of service tasks |
|
| 47 |
+ that the scheduler updates simultaneously. |
|
| 51 | 48 |
|
| 49 |
+ By default, when an update to an individual task returns a state of |
|
| 50 |
+ `RUNNING`, the scheduler schedules another task to update until all tasks |
|
| 51 |
+ are updated. If, at any time during an update a task returns `FAILED`, the |
|
| 52 |
+ scheduler pauses the update. You can control the behavior using the |
|
| 53 |
+ `--update-failure-action` flag for `docker service create` or |
|
| 54 |
+ `docker service update`. |
|
| 52 | 55 |
|
| 53 | 56 |
3. Inspect the `redis` service: |
| 54 | 57 |
|
| ... | ... |
@@ -77,13 +79,15 @@ applies the update to nodes according to the `UpdateConfig` policy: |
| 77 | 77 |
redis |
| 78 | 78 |
``` |
| 79 | 79 |
|
| 80 |
- The scheduler applies rolling updates as follows: |
|
| 80 |
+ The scheduler applies rolling updates as follows by default: |
|
| 81 | 81 |
|
| 82 |
- * Stop the initial number of tasks according to `--update-parallelism`. |
|
| 83 |
- * Schedule updates for the stopped tasks. |
|
| 84 |
- * Start the containers for the updated tasks. |
|
| 85 |
- * After an update to a task completes, wait for the specified delay |
|
| 86 |
- period before stopping the next task. |
|
| 82 |
+ * Stop the first task. |
|
| 83 |
+ * Schedule update for the stopped task. |
|
| 84 |
+ * Start the container for the updated task. |
|
| 85 |
+ * If the update to a task returns `RUNNING`, wait for the |
|
| 86 |
+ specified delay period then stop the next task. |
|
| 87 |
+ * If, at any time during the update, a task returns `FAILED`, pause the |
|
| 88 |
+ update. |
|
| 87 | 89 |
|
| 88 | 90 |
5. Run `docker service inspect --pretty redis` to see the new image in the |
| 89 | 91 |
desired state: |
| ... | ... |
@@ -105,7 +109,31 @@ desired state: |
| 105 | 105 |
Resources: |
| 106 | 106 |
``` |
| 107 | 107 |
|
| 108 |
-6. Run `docker service tasks <TASK-ID>` to watch the rolling update: |
|
| 108 |
+ The output of `service inspect` shows if your update paused due to failure: |
|
| 109 |
+ |
|
| 110 |
+ ```bash |
|
| 111 |
+ $ docker service inspect --pretty redis |
|
| 112 |
+ |
|
| 113 |
+ ID: 0u6a4s31ybk7yw2wyvtikmu50 |
|
| 114 |
+ Name: redis |
|
| 115 |
+ ...snip... |
|
| 116 |
+ Update status: |
|
| 117 |
+ State: paused |
|
| 118 |
+ Started: 11 seconds ago |
|
| 119 |
+ Message: update paused due to failure or early termination of task 9p7ith557h8ndf0ui9s0q951b |
|
| 120 |
+ ...snip... |
|
| 121 |
+ ``` |
|
| 122 |
+ |
|
| 123 |
+ To restart a paused update run `docker service update <SERVICE-ID>`. For example: |
|
| 124 |
+ |
|
| 125 |
+ ```bash |
|
| 126 |
+ docker service update redis |
|
| 127 |
+ ``` |
|
| 128 |
+ |
|
| 129 |
+ To avoid repeating certain update failures, you may need to reconfigure the |
|
| 130 |
+ service by passing flags to `docker service update`. |
|
| 131 |
+ |
|
| 132 |
+6. Run `docker service tasks <SERVICE-ID>` to watch the rolling update: |
|
| 109 | 133 |
|
| 110 | 134 |
```bash |
| 111 | 135 |
$ docker service tasks redis |