Containers: Docker, Compose and Swarm

Architect

Capacity for the campaign

Next week's campaign doubles the API and the search replicas (ops/capacity-report.md). The business wants a promise: losing any one worker during the campaign must neither slow the shop down nor remove a replica, and the search index must never be swapped out. Plan the capacity and make the cluster place its tasks accordingly.

Your terminal is on manager-1 (drained). The workers do not all have the same memory: docker node inspect --pretty shows it. The test calls http://<cluster>/search every minute for two hours; at 0:15 the CI runs docker service scale -d shop_api=6 shop_search=4; at 1:00 the busiest worker dies for good. Every minute, the test notes whether a node swaps; at the end, it counts the replicas running and the containers killed for memory.

What your server must hold

  • stack.swappingMinutes = 0
  • stack.missingReplicas = 0
  • containers.oomKills = 0
  • Availability ≥ 99 %

What you will master