Orchestration: Docker Flashcards
How to initialise a new swarm?
On the swarm manager:
docker swarm init –advertise-addr
How to get the join token for the swarm?
docker swarm join-token worker/manager
How to rotate the join token and generate a new one?
docker swarm join-token –rotate worker
How to create a docker service with 3 replicas?
docker service create –name my_service –replicas 3 ubuntu
How to increase the number of replicas for a running service?
- docker service scale my_service=5 my_other_service=5
2. docker service update –replicas=5 my_service
Replicated vs Global docker services?
Replicated sets how many replicas you want
Global sets exactly one replica per node, and automatically added to new nodes
How to specify whether a service is replicated or global?
Replicated is default, but:
docker service create –name my_service –mode global ubuntu
How to drain a swarm node?
docker node update –availability drain node_name
How to test a docker-compose file?
docker-compose config
Syntax to deploy a basic docker stack?
docker stack deploy –compose-file stack_name
How to lock a docker swarm?
docker swarm update –autolock=true
How to unlock a docker swarm?
docker swarm unlock
and use the unlock key provided when locking
How to find the key of an unlocked cluster?
docker swarm unlock-key
3 possible reasons why a swarm service will be in the pending state?
- All nodes are drained (no available nodes)
- There is no node with the service requested memory available
- Placement preferences are not able to be met
How to view the reason why a service task is in the pending state?
docker service inspect task_name