Orchestration (25%) Flashcards
Orchestration (25%)
Which command do you use to create a new swarm?
docker swarm init –advertise-addr
What is this flag –advertise-addr for?
This flag configures the IP address for the manager node and The other nodes in the swarm must be able to access the manager at the IP address.
How do you know the current status of the swarm?
docker info // you can find the info under the swarm section
Which command do you use to find the information about the nodes in the swarm?
docker node ls
How to add another manager to the swarm?
// it generate the instructions for the manager to be addeddocker swarm join-token manager
How to add another worker node to the swarm?
// it generate the instructions for the worker to be addeddocker swarm join-token worker
How to run the container?
docker run
What is the autolock feature in the Docker swarm?
When Docker restarts, both the TLS key used to encrypt communication among swarm nodes, and the key used to encrypt and decrypt Raft logs on disk, are loaded into each manager node’s memory.Docker 1.13 introduces the ability to protect the mutual TLS encryption key and the key used to encrypt and decrypt Raft logs at rest, by allowing you to take ownership of these keys and to require manual unlocking of your managers. This feature is called autolock.
How to lock the swarm?
// This command produces unlock key. You need to place that in safe placedocker swarm init –autolock
How to unlock the swarm?
docker swarm unlock
Are we able to enable autolock feature only when we create a swarm for the first time?
No. You can lock the existing swarm as well
How to enable or disable autolock on the existing swarm?
//enable autolockdocker swarm update –autolock=true//disable autolockdocker swarm update –autolock=false
How to view the current unlock key for the running swarm?
docker swarm unlock-key
How to rotate the unlock key?
docker swarm unlock-key –rotate
If the key was rotated after one of the manager nodes became unavailable and if you don’t have access to the previous key you may need to force the manager to leave the swarm and join it back as a new manager. Is this statement correct?
yes
How to deploy a service in the docker swarm?
// for the nginx imagedocker create service –replicas 3 –name nginx-web nginx
How to list the services in the Docker swarm?
docker service ls
How to list the tasks of the service in the Docker swarm?
docker service ps
How to inspect the service on the swarm?
docker service inspect
How to inspect the service on the swarm so that it will print limited information in an easily readable format?
docker service inspect –pretty
How to find out which nodes are running the service?
docker service ps SERVICE_ID
How to find out more details of the container running these tasks of the service?
// you need to run this command on the particular nodedocker ps