Bird
0
0

Which of the following is the correct syntax to deploy a service named webapp with 5 replicas in Docker Swarm?

easy📝 Syntax Q3 of 15
Docker - Swarm
Which of the following is the correct syntax to deploy a service named webapp with 5 replicas in Docker Swarm?
Adocker service run --replicas 5 --name webapp nginx
Bdocker swarm deploy --replicas 5 --name webapp nginx
Cdocker container run --replicas 5 --name webapp nginx
Ddocker service create --replicas 5 --name webapp nginx
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct command for service creation

    'docker service create' is the correct command to deploy services in Swarm.
  2. Step 2: Check syntax correctness

    docker service create --replicas 5 --name webapp nginx uses correct flags '--replicas 5' and '--name webapp' with image 'nginx'. Others use invalid commands.
  3. Final Answer:

    docker service create --replicas 5 --name webapp nginx -> Option D
  4. Quick Check:

    Service creation syntax = docker service create [OK]
Quick Trick: Use 'docker service create' with --replicas to scale services [OK]
Common Mistakes:
  • Using 'docker swarm deploy' which is invalid
  • Confusing 'docker container run' with service creation
  • Using 'docker service run' which does not exist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes