cAdvisor (https://github.com/google/cadvisor) allows to monitor the performance of a container. It displays information on CPU and memory usage. cAdvisor is written in Go. It captures the metrics that the
docker stats command returns and aggregates them.
Let’s launch cAdvisor in a Docker container :
docker run \
Unable to find image 'google/cadvisor:latest' locally latest: Pulling from google/cadvisor [1B5c916c92: Pulling fs layer [1B5bb65cdf: Pulling fs layer [1BDigest: sha256:815386ebbe9a3490f38785ab11bda34ec8dacf4634af77b8912832d4f85dca04 Status: Downloaded newer image for google/cadvisor:latest f9c03c73404c04bf371fd501e5a9dab999ebddaf18084a91b4aafbf26459d37b
In order to work, we must give cAdvisor access to the necessary resources on the host. To give full access to the host devices, the container must be launched with the
To access cAdvisor, in a Web browser, go to http://0.0.0.0:8080/.
cAdvisor displays the following sections :
This web page displays the following sections :
Overviewsection displays gauges to indicate if the resources have reached their limits.
Processessection displays information from the
docker ps aux,
docker topcommands in tabular form; to sort the processes, click on the header of the corresponding column. The columns are:
User: this is the user who runs the process,
PID: this is the ID of the process,
PPID: this is the PID of the parent process,
Start Time: this is the time the process starts,
CPU %: this is the percentage of CPU consumed,
MEM %: this is the percentage of RAM consumed,
RSS: this is the amount of main memory consumed,
Virtual Size: this is the amount of virtual memory consumed,
Status: this is the current state of the process (standard Linux status codes),
Running Time: this is the process execution time,
Command: This is the command executed by the process,
Container: this is the container to which the process is attached.
CPUsection shows the CPU usage with the columns:
Total Usage: this is the aggregate usage of all cores,
Usage per Core: this is a breakdown of usage per core,
Usage Breakdown: this is the aggregated usage on all cores but distributed between what is used by the kernel and by the user’s processes.
Memorysection is divided into two parts :
Total Usage: the total amount of memory used by all processes for the host or container: it is equal to
Hot Memorycorresponds to the pages that have been recently affected by the kernel;
Cold Memorycorresponds to the page that has not been touched for a certain period of time and which could be claimed if necessary.
Usage Breakdown: it gives a visual representation of
Networksection displays :
Throughput: shows incoming and outgoing traffic over the last minute;
Errors: these are network errors, so this graph should be flat.
Filesystemsection shows a breakdown of filesystem usage.
Subcontainerssection shows the top CPU usage and the top memory usage.
At the top of the page is a link to the running containers to view their statistics.
At the top of the page there is a link
Docker Containers to display statistics about the Docker host.
This page contains the following sections:
Subcontainerssection displays a list of clickable containers. By clicking on the name, cAdvisor displays details on:
- the isolation (
CPU: these are the CPU allocations of the container; if there are no resource limits, information about the host CPU is displayed,
Memory: these are the memory allocations of the container,
- usage (
Overview: these are the gauges that allow you to see if you are approaching the resource limits,
Processes: these are the processes of the container,
CPU: these are the usage graphs of the CPU isolated from the container,
Memory: this is the use of the container’s memory.
- the isolation (
Driver Statussection displays:
- the basic statistics of the main Docker process,
- information about the host kernel,
- the name of the host,
- the operating system used,
- the total number of containers and images (the number of images counts each file system as an individual image).
- The section
Imagesdisplays the list of Docker images available on the host: Repository, tag, size, image creation date, image ID.
You now know how to obtain a large amount of very useful statistics on Docker containers, allowing you to diagnose problems and optimize container performance.