docs: service create: use markdown table for constraints
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e6f9e5e283
commit
abeb7babdf
@ -671,44 +671,18 @@ constraint expressions. Multiple constraints find nodes that satisfy every
|
|||||||
expression (AND match). Constraints can match node or Docker Engine labels as
|
expression (AND match). Constraints can match node or Docker Engine labels as
|
||||||
follows:
|
follows:
|
||||||
|
|
||||||
|
node attribute | matches | example
|
||||||
<table>
|
-------------------|--------------------------|-----------------------------------------------
|
||||||
<tr>
|
`node.id` | Node ID | `node.id==2ivku8v2gvtg4`
|
||||||
<th>node attribute</th>
|
`node.hostname` | Node hostname | `node.hostname!=node-2`
|
||||||
<th>matches</th>
|
`node.role` | Node role | `node.role==manager`
|
||||||
<th>example</th>
|
`node.labels` | User-defined node labels | `node.labels.security==high`
|
||||||
</tr>
|
`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04`
|
||||||
<tr>
|
|
||||||
<td><tt>node.id</tt></td>
|
|
||||||
<td>Node ID</td>
|
|
||||||
<td><tt>node.id==2ivku8v2gvtg4</tt></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><tt>node.hostname</tt></td>
|
|
||||||
<td>Node hostname</td>
|
|
||||||
<td><tt>node.hostname!=node-2</tt></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><tt>node.role</tt></td>
|
|
||||||
<td>Node role</td>
|
|
||||||
<td><tt>node.role==manager</tt></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><tt>node.labels</tt></td>
|
|
||||||
<td>user defined node labels</td>
|
|
||||||
<td><tt>node.labels.security==high</tt></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><tt>engine.labels</tt></td>
|
|
||||||
<td>Docker Engine's labels</td>
|
|
||||||
<td><tt>engine.labels.operatingsystem==ubuntu 14.04</tt></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
`engine.labels` apply to Docker Engine labels like operating system,
|
`engine.labels` apply to Docker Engine labels like operating system, drivers,
|
||||||
drivers, etc. Swarm administrators add `node.labels` for operational purposes by
|
etc. Swarm administrators add `node.labels` for operational purposes by using
|
||||||
using the [`docker node update`](node_update.md) command.
|
the [`docker node update`](node_update.md) command.
|
||||||
|
|
||||||
For example, the following limits tasks for the redis service to nodes where the
|
For example, the following limits tasks for the redis service to nodes where the
|
||||||
node type label equals queue:
|
node type label equals queue:
|
||||||
@ -716,7 +690,7 @@ node type label equals queue:
|
|||||||
```bash
|
```bash
|
||||||
$ docker service create \
|
$ docker service create \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
--constraint 'node.labels.type == queue' \
|
--constraint node.labels.type==queue \
|
||||||
redis:3.0.6
|
redis:3.0.6
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -730,7 +704,7 @@ of datacenters or availability zones. The example below illustrates this:
|
|||||||
$ docker service create \
|
$ docker service create \
|
||||||
--replicas 9 \
|
--replicas 9 \
|
||||||
--name redis_2 \
|
--name redis_2 \
|
||||||
--placement-pref 'spread=node.labels.datacenter' \
|
--placement-pref spread=node.labels.datacenter \
|
||||||
redis:3.0.6
|
redis:3.0.6
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user