Check RAM & CPU usage of containers

If your server host is experiencing high RAM and/or CPU usage, despite adhering to the tech specs, you can check via the command line which container is consuming the available host RAM/CPU.

To do this, establish a connection to your host and run the following command (as sudo):

sudo docker stats
docker stats: showing CPU & RAM usage of the individual containers

All containers share the resources available within the Docker environment, except for those that haven't been restricted via resource constraints (optional, not by default).

For example, CPU usage can range from 0% to 800% for an 8-core CPU, or 900% for a 9-core CPU, and so forth.

RAM usage is displayed in the MEM USAGE column, while the maximum amount of RAM (for all containers) is visible in the LIMIT column.

It's important to note that the LIMIT is the same for all containers, so you need to tally up the values from the MEM USAGE column to determine the current actively used RAM.