Signed-off-by: Charles Smith <charles.smith@docker.com>
| ... | ... |
@@ -94,7 +94,7 @@ ID NAME REPLICAS IMAGE COMMAND |
| 94 | 94 |
``` |
| 95 | 95 |
|
| 96 | 96 |
|
| 97 |
-### Create a service with a rolling update constraints |
|
| 97 |
+### Create a service with a rolling update policy |
|
| 98 | 98 |
|
| 99 | 99 |
|
| 100 | 100 |
```bash |
| ... | ... |
@@ -133,7 +133,7 @@ $ docker service create \ |
| 133 | 133 |
For more information about labels, refer to [apply custom |
| 134 | 134 |
metadata](../../userguide/labels-custom-metadata.md) |
| 135 | 135 |
|
| 136 |
-### Service mode |
|
| 136 |
+### Set service mode |
|
| 137 | 137 |
|
| 138 | 138 |
Is this a replicated service or a global service. A replicated service runs as |
| 139 | 139 |
many tasks as specified, while a global service runs on each active node in the |
| ... | ... |
@@ -145,6 +145,33 @@ The following command creates a "global" service: |
| 145 | 145 |
$ docker service create --name redis_2 --mode global redis:3.0.6 |
| 146 | 146 |
``` |
| 147 | 147 |
|
| 148 |
+### Specify service constraints |
|
| 149 |
+ |
|
| 150 |
+You can limit the set of nodes where a task can be scheduled by defining |
|
| 151 |
+constraint expressions. Multiple constraints find nodes that satisfy every |
|
| 152 |
+expression (AND match). Constraints can match node or Docker Engine labels as |
|
| 153 |
+follows: |
|
| 154 |
+ |
|
| 155 |
+| node attribute | matches | example | |
|
| 156 |
+|:------------- |:-------------| :---------------------------------------------| |
|
| 157 |
+| node.id | node ID | `node.id == 2ivku8v2gvtg4` | |
|
| 158 |
+| node.hostname | node hostname | `node.hostname != node-2` | |
|
| 159 |
+| node.role | node role: manager | `node.role == manager` | |
|
| 160 |
+| node.labels | user defined node labels | `node.labels.security == high` | |
|
| 161 |
+| engine.labels | Docker Engine's labels | `engine.labels.operatingsystem == ubuntu 14.04`| |
|
| 162 |
+ |
|
| 163 |
+`engine.labels` apply to Docker Engine labels like operating system, |
|
| 164 |
+drivers, etc. Swarm administrators add `node.labels` for operational purposes by |
|
| 165 |
+using the `docker node update` command. |
|
| 166 |
+ |
|
| 167 |
+For example, the following limits tasks for the redis service to nodes where the |
|
| 168 |
+node type label equals queue: |
|
| 169 |
+ |
|
| 170 |
+```bash |
|
| 171 |
+$ docker service create \ |
|
| 172 |
+ --name redis_2 \ |
|
| 173 |
+ --constraint node.labels.type == queue |
|
| 174 |
+``` |
|
| 148 | 175 |
|
| 149 | 176 |
## Related information |
| 150 | 177 |
|