0
0
Dockerdevops~5 mins

Deploying services in Swarm in Docker - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Docker Swarm?
Docker Swarm is a tool that lets you manage a group of Docker engines as a single virtual system. It helps you deploy and scale services easily across multiple machines.
Click to reveal answer
beginner
How do you initialize a Docker Swarm on a manager node?
You run the command docker swarm init on the machine you want to be the manager. This sets up the swarm and makes that node the leader.
Click to reveal answer
beginner
What command deploys a new service in Docker Swarm?
Use docker service create followed by options and the image name. For example, docker service create --name myweb nginx deploys an Nginx service named 'myweb'.
Click to reveal answer
beginner
What does the --replicas option do when deploying a service?
It sets how many copies (instances) of the service you want running. For example, --replicas 3 runs three copies of the service.
Click to reveal answer
intermediate
How can you update a running service in Docker Swarm?
Use docker service update with options to change the service. For example, docker service update --replicas 5 myweb changes the number of replicas to 5.
Click to reveal answer
Which command initializes a Docker Swarm manager node?
Adocker swarm init
Bdocker service create
Cdocker swarm join
Ddocker container run
What does the command docker service create --replicas 4 nginx do?
ARemoves 4 nginx containers
BCreates 1 container running nginx
CCreates 4 containers running nginx as a service in Swarm
DUpdates an existing nginx service to 4 replicas
How do you add a worker node to an existing Docker Swarm?
Adocker swarm init
Bdocker swarm join with the manager's token and IP
Cdocker service create
Ddocker container start
Which command shows the list of services running in a Docker Swarm?
Adocker swarm ps
Bdocker container ls
Cdocker node ls
Ddocker service ls
What happens if you scale a service to zero replicas?
AAll service tasks stop running
BOne task keeps running
CThe service is deleted
DThe service restarts automatically
Explain the steps to deploy a new service in Docker Swarm from scratch.
Think about setting up the swarm first, then adding nodes, then deploying the service.
You got /4 concepts.
    Describe how to update the number of replicas for a running service in Docker Swarm.
    Focus on the command that changes service settings without redeploying.
    You got /3 concepts.