Bird
0
0

What will be the output of the command docker service ls in a Docker Swarm cluster?

medium📝 Command Output Q13 of 15
Docker - Production Patterns
What will be the output of the command docker service ls in a Docker Swarm cluster?
AList of all running containers on the host
BList of all services running in the swarm with their replicas
CList of all Docker images available locally
DList of all networks created in Docker
Step-by-Step Solution
Solution:
  1. Step 1: Understand the command purpose

    docker service ls shows all services in the swarm, including how many replicas each has.
  2. Step 2: Compare with other options

    It lists services and replicas, not individual containers (<code>docker ps</code>), images (<code>docker images</code>), or networks (<code>docker network ls</code>).
  3. Final Answer:

    List of all services running in the swarm with their replicas -> Option B
  4. Quick Check:

    docker service ls = list swarm services [OK]
Quick Trick: 'docker service ls' lists swarm services, not containers [OK]
Common Mistakes:
  • Thinking it lists individual containers
  • Confusing services with images or networks
  • Expecting detailed container logs from this command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes