1

Say I have a single machine and I want to find out how much of the physical CPU is used when I run a container. I am not interested in inside-container stats.

Similarly I want to find out the memory usage. I am not interested in the memory usage percent inside the container.

For example, for memory, ps shows 2 things things:

$ ps -ax -o %mem,cmd | grep router
0.7 /usr/bin/docker run --rm -p 123:456 --name=the_router ...
5.3 java -jar the-router-fat.jar -conf /usr/verticles/conf/config.json

Second line is actually the command I execute inside the Docker container. The first line is the command I run to start the container.

Docker stats command shows a different number:

$ docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemPerc}}"
CONTAINER           CPU %               MEM %
1218ee798de6        0.15%               4.85%

Can I assume the value Docker stats return is the memory usage of the host system?

1

You can use docker stats to see the CPU and memory usage of docker containers. Check this question for reference : https://stackoverflow.com/questions/18956063/memory-usage-of-docker-containers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.