Which command can change the number of replicas in a service to 5? (Choose two)

Prepare for the Docker Certified Associate test with our comprehensive quizzes that include key questions and detailed explanations. Ace your certification!

The command that effectively changes the number of replicas in a service to 5 is the first option: using "docker service update --replicas 5 my-service." This command modifies the existing service by updating its configuration to have 5 replicas. It is part of the Docker command-line interface, specifically tailored for managing services in a swarm mode. By executing this command, Docker understands that the desired state for the service "my-service" is now 5 replicas, and it will take the necessary actions to achieve this state.

The second option that can achieve the same result is "docker service scale my-service=5." This command is explicitly intended for scaling services within a Docker swarm. It directly sets the number of replicas to 5 for the specified service without needing to adjust other parameters.

The other options do not represent valid Docker commands for achieving the desired effect. Hence, they are not correct answers for the question regarding changing the number of replicas.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy