Bird
0
0

You want to monitor CPU and memory usage of two specific containers named webapp and db with a single snapshot. Which command should you run?

hard📝 Application Q15 of 15
Docker - Logging and Monitoring
You want to monitor CPU and memory usage of two specific containers named webapp and db with a single snapshot. Which command should you run?
Adocker stats --no-stream webapp db
Bdocker stats webapp db --no-stream
Cdocker stats --no-stream --filter webapp --filter db
Ddocker stats --filter name=webapp,db --no-stream
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to specify multiple containers

    Docker stats accepts container names as arguments separated by spaces to monitor multiple containers.
  2. Step 2: Use the correct flag placement

    The --no-stream flag should come before container names; docker stats --no-stream webapp db places it correctly.
  3. Step 3: Evaluate other options

    docker stats webapp db --no-stream incorrectly places the flag after container names, causing Docker to interpret --no-stream as a container name and resulting in an error. Options C and D use invalid or unsupported --filter syntax for this command.
  4. Final Answer:

    docker stats --no-stream webapp db -> Option A
  5. Quick Check:

    Multiple containers + --no-stream = docker stats --no-stream webapp db [OK]
Quick Trick: List containers after --no-stream for snapshot [OK]
Common Mistakes:
  • Using invalid --filter syntax
  • Placing flags after container names incorrectly
  • Trying to monitor stopped containers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes