0
0
Dockerdevops~5 mins

Resource monitoring per container in Docker - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Adocker inspect
Bdocker ps
Cdocker logs
Ddocker stats
How do you limit a container to use only 2 CPUs?
Adocker run --cpus=2
Bdocker run --memory=2
Cdocker run --cpu-limit=2
Ddocker run --limit-cpu=2
What does the 'NET I/O' column in docker stats show?
ANetwork input and output data usage
BCPU network priority
CNumber of network interfaces
DNetwork latency
To monitor only one container's resource usage, you should:
Adocker logs &lt;container_name_or_id&gt;
Bdocker ps &lt;container_name_or_id&gt;
Cdocker stats &lt;container_name_or_id&gt;
Ddocker inspect &lt;container_name_or_id&gt;
Why is it important to set resource limits on containers?
ATo speed up container startup time
BTo prevent containers from using too many resources and affecting other containers or the host
CTo increase container storage space
DTo enable container networking
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.