nerdexam
Docker

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.

Submitted by lars.no· Apr 18, 2026Container Orchestration

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)
  • A
    88% (29)
  • B
    3% (1)
  • C
    3% (1)
  • D
    6% (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`.

A'docker service update --replicas=5 <service-id>'Correct

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.

B'docker replica update <service-id>=5'

`docker replica update` is not a valid Docker CLI command for scaling services.

C'docker update service <service-id>=5'

`docker update service` is not the correct command structure; the correct one is `docker service update`.

D'docker service replicas <service-id>=5'

`docker service replicas` is not a valid Docker CLI command for setting the replica count.

E'docker service scale <service-id> = 5''Correct

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

#Docker Swarm#Service Scaling#Docker CLI#Service Management

Community Discussion

No community discussion yet for this question.

Full DCA Practice