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 createStacks manages all those objects for us, including overlay network per stack. Adds stack name to start of their name
New
deploy:
key in Compose file. Can't dobuild:
Compose now ignores
deploy:
, Swarm ignoresbuild:
docker-compose
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.
Last updated
Was this helpful?