Recall & Review
beginner
What command shows real-time resource usage of all running Docker containers?
The command
docker stats displays live CPU, memory, network, and disk I/O usage for all running containers.Click to reveal answer
intermediate
How can you limit the CPU usage of a Docker container?
Use the
--cpus flag when running a container, for example: docker run --cpus=1.5 limits the container to 1.5 CPU cores.Click to reveal answer
beginner
What does the
docker stats output column 'MEM USAGE / LIMIT' represent?It shows the current memory used by the container and the maximum memory allowed (limit) if set.
Click to reveal answer
beginner
How to monitor resource usage of a specific container only?
Run
docker stats <container_id_or_name> to see resource usage for just that container.Click to reveal answer
beginner
What is the purpose of setting resource limits on containers?
Resource limits prevent a container from using too much CPU or memory, helping keep the host system stable and fair to other containers.
Click to reveal answer
Which Docker command shows live CPU and memory usage of containers?
✗ Incorrect
docker stats shows live resource usage like CPU and memory for containers.
How do you limit a container to use only 2 CPUs?
✗ Incorrect
The --cpus flag limits CPU cores, so --cpus=2 restricts to 2 CPUs.
What does the 'NET I/O' column in
docker stats show?✗ Incorrect
'NET I/O' shows how much data the container has sent and received over the network.
To monitor only one container's resource usage, you should:
✗ Incorrect
docker stats with container ID or name shows resource usage for that container only.
Why is it important to set resource limits on containers?
✗ Incorrect
Resource limits keep containers from overusing CPU or memory, protecting system stability.
Explain how to monitor resource usage for Docker containers and why it is useful.
Think about commands and what information they show.
You got /4 concepts.
Describe how to set CPU and memory limits on a Docker container and the benefits of doing so.
Consider the flags used when running containers.
You got /4 concepts.