Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to initialize a Docker Swarm manager node.
Docker
docker swarm [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'join' instead of 'init' to start the swarm.
✗ Incorrect
The docker swarm init command starts a new swarm and makes the current node a manager.
2fill in blank
mediumComplete the command to add a worker node to the swarm using a token.
Docker
docker swarm [1] --token SWMTKN-1-0-xyz 192.168.1.10:2377
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'init' instead of 'join' to add a worker node.
✗ Incorrect
The docker swarm join command adds a node to an existing swarm as a worker or manager.
3fill in blank
hardFix the error in the command to list all nodes in the swarm.
Docker
docker node [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'list' or 'show' which are invalid commands here.
✗ Incorrect
The correct command to list nodes is docker node ls.
4fill in blank
hardFill both blanks to create a service that runs on worker nodes only.
Docker
docker service create --name myservice --constraint 'node.role [1] [2]' nginx
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' or 'manager' which exclude workers.
✗ Incorrect
The constraint node.role == worker ensures the service runs only on worker nodes.
5fill in blank
hardFill all three blanks to update a service to run only on manager nodes with 3 replicas.
Docker
docker service update --replicas [1] --constraint-add 'node.role [2] [3]' myservice
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'worker' role or wrong operators.
✗ Incorrect
Setting replicas to 3 and constraint node.role == manager updates the service accordingly.