Placement Constraints

Manage capacity planning and data locality with placement constraints.


Use placement constraints with stateful services

Because Docker Swarm does not currently support persistent volume claims, we recommend using stringent placement constraints to pin stateful services, such as a cache or database, to specific machines.

Placement constraints introduce conditions for a container to determine on which nodes to run. Two common examples of placement constraints are:

  • Labels, e.g. node.labels.{key} == {value} using the == comparator.
  • Labels, e.g. node.role != {role} using the != comparator. Roles can be worker or manager.

To get a better understanding of the types of conditions that can be used, you can read more about how to use placement constraints on the official Docker documentation.