DCA · Question #39
You have deployed a service to swarm. Which command uses the Docker CLI to set the number of tasks of the services to 5? (choose 2)
The correct answer is A. 'docker service update --replicas=5 <service-id>' E. 'docker service scale <service-id> = 5''. To set the number of tasks for a Docker Swarm service to 5, you can use either docker service update --replicas=5 <service-id> or docker service scale <service-id>=5.
Question
You have deployed a service to swarm. Which command uses the Docker CLI to set the number of tasks of the services to 5? (choose 2)
Options
- A'docker service update --replicas=5 <service-id>'
- B'docker replica update <service-id>=5'
- C'docker update service <service-id>=5'
- D'docker service replicas <service-id>=5'
- E'docker service scale <service-id> = 5''
How the community answered
(33 responses)- A88% (29)
- B3% (1)
- C3% (1)
- D6% (2)
Why each option
To set the number of tasks for a Docker Swarm service to 5, you can use either `docker service update --replicas=5 <service-id>` or `docker service scale <service-id>=5`.
The `docker service update` command is used to modify the configuration of a running service, and the `--replicas` flag specifically sets the desired number of tasks (replicas) for that service.
`docker replica update` is not a valid Docker CLI command for scaling services.
`docker update service` is not the correct command structure; the correct one is `docker service update`.
`docker service replicas` is not a valid Docker CLI command for setting the replica count.
The `docker service scale` command is a convenient shorthand specifically designed for quickly adjusting the number of replicas for one or more services in a Docker Swarm.
Concept tested: Scaling Docker Swarm services
Source: https://docs.docker.com/engine/reference/commandline/service_update/ https://docs.docker.com/engine/reference/commandline/service_scale/
Topics
Community Discussion
No community discussion yet for this question.