DCA · Question #42
A docker service 'web' is running with a scale factor of 1 (replicas = 1). Bob intends to use the command 'docker service update --replicas=3 web'. Alice intends to use the command 'docker service…
The correct answer is D. Both Bob's and Alice's commands result in exactly the same outcome, which is 3 instances of the. Both docker service update --replicas and docker service scale commands achieve the same outcome of changing the number of running instances for a Docker Swarm service.
Question
A docker service 'web' is running with a scale factor of 1 (replicas = 1). Bob intends to use the command 'docker service update --replicas=3 web'. Alice intends to use the command 'docker service scale web=3'. How do the outcomes oft these two commands differ?
Options
- ABob's command results in an error. Alice's command updates the number of replicas of the 'web'
- BBob's command only updates the service definition, but no new replicas are started. Alice's
- CBob's command updates the number of replicas of the 'web' service to 3. Alice's command results
- DBoth Bob's and Alice's commands result in exactly the same outcome, which is 3 instances of the
How the community answered
(55 responses)- A5% (3)
- B2% (1)
- C4% (2)
- D89% (49)
Why each option
Both `docker service update --replicas` and `docker service scale` commands achieve the same outcome of changing the number of running instances for a Docker Swarm service.
Bob's command is a valid way to update service replicas and will not result in an error.
Both commands update the service definition and trigger the Docker Swarm orchestrator to start new replicas, they do not just update the definition without action.
Both commands have the same effect of scaling the service to 3 replicas, not different outcomes.
Both `docker service update --replicas=3 web` and `docker service scale web=3` result in exactly the same outcome: the 'web' service is scaled to have 3 running instances (replicas). The `docker service scale` command is a convenient shorthand that performs the same underlying service update operation as `docker service update --replicas`.
Concept tested: Docker Swarm service scaling commands
Source: https://docs.docker.com/engine/reference/commandline/service_scale/
Topics
Community Discussion
No community discussion yet for this question.