Stacks: Production Grade Compose
- In 1.13 Docker added a new layer of abstraction to Swarm called Stacks
- Stacks accept Compose files as their declarative definition for services, networks, and volumes
- We use
docker stack deploy rather than docker service create
- Stacks manages all those objects for us, including overlay network per stack. Adds stack name to start of their name
deploy: key in Compose file. Can't do
- Compose now ignores
deploy:, Swarm ignores
cli not needed on Swarm server
Keep in mind
- Update of stack is done with same command as creating it, e.g.
docker stack deploy -c app-stack.yml app
- You want to do all the changes in the YAML Stack file and never directly via docker commands, because yaml is the source of truth and any of your changes that are not reflected in file are going to be overwritten.