Bird
0
0

You want to monitor Docker events for containers with label env=production and only see start and die events. Which command achieves this?

hard📝 Workflow Q15 of 15
Docker - Logging and Monitoring
You want to monitor Docker events for containers with label env=production and only see start and die events. Which command achieves this?
Adocker events --filter label=env=production --filter event=start --filter event=die
Bdocker events --filter label=env=production --filter event=start,die
Cdocker events --filter label=env=production --filter event=start --filter event=stop
Ddocker events --filter env=production --filter event=start --filter event=die
Step-by-Step Solution
Solution:
  1. Step 1: Use multiple --filter flags for each event

    Docker events supports multiple filters; to filter multiple events, repeat the --filter event= flag for each event.
  2. Step 2: Use correct label filter syntax

    The label filter requires label=key=value format, so label=env=production is correct.
  3. Step 3: Eliminate incorrect options

    docker events --filter label=env=production --filter event=start,die uses comma-separated events which is invalid; docker events --filter label=env=production --filter event=start --filter event=stop uses stop instead of die; docker events --filter env=production --filter event=start --filter event=die uses incorrect label filter syntax.
  4. Final Answer:

    docker events --filter label=env=production --filter event=start --filter event=die -> Option A
  5. Quick Check:

    Multiple --filter flags for each event and correct label syntax [OK]
Quick Trick: Repeat --filter for each event; label filter needs key=value [OK]
Common Mistakes:
  • Using comma-separated events in one filter
  • Wrong label filter syntax
  • Confusing event names like die vs stop

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes