Show Menu
Cheatography

Docker Stack Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Setup

docker swarm init
Start a swarm, with this machine as manager
docker service create --name registry --publish publis­hed­=50­00,­tar­get­=5000 registry:2
Create registry
curl http:/­/lo­cal­hos­t:5­000/v2/
Test Registry
docker­-co­mpose build && docker­-co­mpose push
Build and push service containers

Deploy

docker stack deploy --comp­ose­-file docker­-co­mpo­se.yml STACK_NAME
Deploy the stack
docker stack services STACK_NAME
Check status of stack

Update services

docker­-co­mpose build && docker­-co­mpose push
Rebuild and push service containers
docker stack deploy --comp­ose­-file docker­-co­mpo­se.yml STACK_NAME
Update any out of date services

Teardown

docker stack rm STACK_NAME
Kill all services
docker service rm registry
Kill registry
docker swarm leave --force
Leave the swam

Addendum