add constraint to service create ref
Signed-off-by: Charles Smith <charles.smith@docker.com>
This commit is contained in:
parent
59e2c57540
commit
bf31e188d9
@ -94,7 +94,7 @@ ID NAME REPLICAS IMAGE COMMAND
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Create a service with a rolling update constraints
|
### Create a service with a rolling update policy
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -133,7 +133,7 @@ $ docker service create \
|
|||||||
For more information about labels, refer to [apply custom
|
For more information about labels, refer to [apply custom
|
||||||
metadata](../../userguide/labels-custom-metadata.md)
|
metadata](../../userguide/labels-custom-metadata.md)
|
||||||
|
|
||||||
### Service mode
|
### Set service mode
|
||||||
|
|
||||||
Is this a replicated service or a global service. A replicated service runs as
|
Is this a replicated service or a global service. A replicated service runs as
|
||||||
many tasks as specified, while a global service runs on each active node in the
|
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:
|
|||||||
$ docker service create --name redis_2 --mode global redis:3.0.6
|
$ docker service create --name redis_2 --mode global redis:3.0.6
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Specify service constraints
|
||||||
|
|
||||||
|
You can limit the set of nodes where a task can be scheduled by defining
|
||||||
|
constraint expressions. Multiple constraints find nodes that satisfy every
|
||||||
|
expression (AND match). Constraints can match node or Docker Engine labels as
|
||||||
|
follows:
|
||||||
|
|
||||||
|
| node attribute | matches | example |
|
||||||
|
|:------------- |:-------------| :---------------------------------------------|
|
||||||
|
| node.id | node ID | `node.id == 2ivku8v2gvtg4` |
|
||||||
|
| node.hostname | node hostname | `node.hostname != node-2` |
|
||||||
|
| node.role | node role: manager | `node.role == manager` |
|
||||||
|
| node.labels | user defined node labels | `node.labels.security == high` |
|
||||||
|
| engine.labels | Docker Engine's labels | `engine.labels.operatingsystem == ubuntu 14.04`|
|
||||||
|
|
||||||
|
`engine.labels` apply to Docker Engine labels like operating system,
|
||||||
|
drivers, etc. Swarm administrators add `node.labels` for operational purposes by
|
||||||
|
using the `docker node update` command.
|
||||||
|
|
||||||
|
For example, the following limits tasks for the redis service to nodes where the
|
||||||
|
node type label equals queue:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker service create \
|
||||||
|
--name redis_2 \
|
||||||
|
--constraint node.labels.type == queue
|
||||||
|
```
|
||||||
|
|
||||||
## Related information
|
## Related information
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user