Orchestration: Docker Flashcards

1
Q

How to initialise a new swarm?

A

On the swarm manager:

docker swarm init –advertise-addr

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to get the join token for the swarm?

A

docker swarm join-token worker/manager

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to rotate the join token and generate a new one?

A

docker swarm join-token –rotate worker

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to create a docker service with 3 replicas?

A

docker service create –name my_service –replicas 3 ubuntu

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to increase the number of replicas for a running service?

A
  1. docker service scale my_service=5 my_other_service=5

2. docker service update –replicas=5 my_service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Replicated vs Global docker services?

A

Replicated sets how many replicas you want

Global sets exactly one replica per node, and automatically added to new nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to specify whether a service is replicated or global?

A

Replicated is default, but:

docker service create –name my_service –mode global ubuntu

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to drain a swarm node?

A

docker node update –availability drain node_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to test a docker-compose file?

A

docker-compose config

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Syntax to deploy a basic docker stack?

A

docker stack deploy –compose-file stack_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to lock a docker swarm?

A

docker swarm update –autolock=true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to unlock a docker swarm?

A

docker swarm unlock

and use the unlock key provided when locking

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to find the key of an unlocked cluster?

A

docker swarm unlock-key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

3 possible reasons why a swarm service will be in the pending state?

A
  1. All nodes are drained (no available nodes)
  2. There is no node with the service requested memory available
  3. Placement preferences are not able to be met
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to view the reason why a service task is in the pending state?

A

docker service inspect task_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Placement preferences vs Placement constraints?

A

Prefs allow you to spread over a specific tag

Constraints limit where services can be run

17
Q

4 ways to control placement of services across nodes?

A
  1. Replicated or Global mode
  2. Resource constraints (CPU/Mem/etc)
  3. Placement constraints
  4. Placement preferences
18
Q

How can templates be used for values when creating a docker service?

A

docker service create –name my_service –hostname=”{{.Node.Hostname}}-{{.Service.Name}}” nginx

19
Q

Which flags support the use of templated values?

A
  • -env
  • -hostname
  • -mount
20
Q

How to prevent the manager node from accepting tasks?

A

Drain the manager node:

docker node update –availability drain manager_node

21
Q

How to recover from losing a quorum on swarm?

A

From a manager node run:

docker swarm init –force-new-cluster –advertise-addre node_ip:node_port

22
Q

What are the 4 docker system child commands?

A

docker system info
docker system df
docker system events
docker system prune