0
0
Dockerdevops~20 mins

Docker events for real-time monitoring - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker Events Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Real-time Docker event stream output
You run the command docker events --filter 'event=start' --filter 'container=myapp'. What output do you expect when the container myapp starts?
Docker
docker events --filter 'event=start' --filter 'container=myapp'
AA JSON line showing the start event for container 'myapp' with timestamp and container ID
BA list of all containers currently running, including 'myapp'
CAn error message: 'unknown flag: --filter'
DNo output until the container 'myapp' stops
Attempts:
2 left
💡 Hint
The command listens for events filtered by type and container name.
🧠 Conceptual
intermediate
1:30remaining
Purpose of Docker events in monitoring
What is the main purpose of using docker events in real-time monitoring?
ATo build Docker images from a Dockerfile
BTo get a live stream of Docker daemon events like container start, stop, and network changes
CTo display the current resource usage of containers
DTo list all Docker images available on the host
Attempts:
2 left
💡 Hint
Think about what 'events' means in system monitoring.
Troubleshoot
advanced
2:00remaining
Troubleshooting missing Docker events output
You run docker events --filter 'event=stop' but see no output even after stopping containers. What is the most likely cause?
AThe filter syntax is incorrect and causes the command to fail silently
BThe Docker daemon is not running
CYou are not running the command with sufficient permissions (not root or in docker group)
DDocker events only show start events, not stop events
Attempts:
2 left
💡 Hint
Consider user permissions for accessing Docker daemon events.
🔀 Workflow
advanced
2:30remaining
Using Docker events to trigger an alert
You want to trigger a script whenever any container stops. Which command pipeline correctly listens for stop events and runs alert.sh?
Adocker ps -a --filter 'status=exited' | ./alert.sh
Bdocker events --filter 'event=stop' --format '{{.ID}}' > alert.sh
Cdocker logs --follow | grep 'stop' | ./alert.sh
Ddocker events --filter 'event=stop' | while read line; do ./alert.sh; done
Attempts:
2 left
💡 Hint
Think about streaming events and running a script on each event line.
Best Practice
expert
3:00remaining
Efficient filtering of Docker events for multiple event types
You want to monitor both container start and die events in real-time with minimal resource use. Which command is best?
Adocker events --filter 'event=start' --filter 'event=die'
Bdocker events | grep -E 'start|die'
Cdocker events --filter 'event=start,die'
Ddocker events --filter 'event=start' && docker events --filter 'event=die'
Attempts:
2 left
💡 Hint
Check how multiple filters are combined in docker events.