Container distribution strategies
Estimated reading time: 1 minuteDocker Cloud can use different distribution strategies when deploying containers to more than one node. You can use different strategies to change how your service distributes new containers when scaling.
Set a deployment distribution strategy
You can set the deployment strategy when creating a service, either through the Docker Cloud web UI, or using the API or CLI. You can also specify a deployment strategy in the stack file used to define a service stack.
For all methods, the default deployment strategy is “Emptiest node”.
Emptiest node (default)
This is the default strategy, and is commonly used to balance the total load of all services across all nodes.
A service configured to deploy using the EMPTIEST_NODE
strategy deploys its
containers to the nodes that match its deploy tags
with the fewest total containers at the time of each container’s deployment,
regardless of the service.
High availability
This setting is typically used to increase the service availability.
A service using the HIGH_AVAILABILITY
strategy deploys its containers to the
node that matches its deploy tags with the fewest containers of that service
at the time of each container’s deployment. This means that the containers will
be spread across all nodes that match the deploy tags for the service.
Every node
A service using the EVERY_NODE
strategy deploys one container on each node that matches its deploy tags.
When a service uses the EVERY_NODE
strategy:
- A new container will be deployed to every new node that matches the service’s deploy tags.
- The service cannot be manually scaled.
- If the service uses volumes, each container on each node will have a different volume.
- If an
EVERY_NODE
“client” service is linked to a “server” service that is also using theEVERY_NODE
strategy, containers will be linked one-to-one on each node. The “client” services will not be automatically linked to “server” services on other nodes.
schedule, deployment, containerNote: Because of how links are configured when using the every node strategy, you cannot currently switch from every node to high availability or emptiest node and vice versa.