Skip to content
Docker

icon picker
Docker constraints

Create a service on manager node only
docker service create --constraints node.role==manager <image_name>

Remove a constraint and add a new constraint
docker service update --constraint-rm <Constraint added on service> --constraint-add <new_constraint> <service_name>

In yml file
version: "3.1"
services:
mysqldb:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: "mypassword"
MYSQL_DATABASE: "mysqldb"
deploy:
replicas: 1
placement:
constraints:
- node.labels.region == east-1-d
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.