Challenge - 5 Problems
Container Resource Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of the command to show live CPU and memory usage of a running container?
You run the command
docker stats my_container --no-stream. What output will you see?Attempts:
2 left
💡 Hint
The --no-stream option shows a snapshot, not a live stream.
✗ Incorrect
The 'docker stats' command with --no-stream shows a single snapshot of resource usage for the specified container. It includes CPU %, memory usage, network IO, block IO, and PIDs.
🧠 Conceptual
intermediate2:00remaining
Which Docker command option limits the CPU usage of a container?
You want to restrict a container to use only 50% of one CPU core. Which option do you use when running the container?
Attempts:
2 left
💡 Hint
CPU shares are relative weights, not exact limits.
✗ Incorrect
The --cpus option limits the container to a specific number of CPUs or fractions. --cpus 0.5 limits to half a CPU core.
❓ Troubleshoot
advanced2:00remaining
Why does 'docker stats' show 0% CPU usage for a busy container?
You notice that 'docker stats' shows 0% CPU usage for a container that is actively processing tasks. What is the most likely reason?
Attempts:
2 left
💡 Hint
Docker stats measures CPU usage of the container's CPU time, not GPU or other hardware.
✗ Incorrect
Docker stats measures CPU usage based on CPU time used by the container processes. If the container uses GPU or other hardware accelerators, CPU usage may appear as zero.
🔀 Workflow
advanced3:00remaining
Order the steps to monitor and limit memory usage of a Docker container
Arrange the following steps in the correct order to monitor and limit memory usage of a Docker container.
Attempts:
2 left
💡 Hint
You must set limits before monitoring and adjusting.
✗ Incorrect
First, set the memory limit when running the container. Then monitor usage with docker stats. Analyze if the limit is exceeded, then adjust and restart if necessary.
✅ Best Practice
expert3:00remaining
Which practice is best for ensuring accurate container resource usage monitoring in production?
You want to monitor CPU and memory usage of containers in production with minimal performance impact and accurate data. Which practice is best?
Attempts:
2 left
💡 Hint
Automated tools designed for container monitoring provide better accuracy and less overhead.
✗ Incorrect
Dedicated monitoring tools like cAdvisor and Prometheus collect detailed container metrics efficiently and provide dashboards and alerts, which is best practice for production environments.