Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker container memory usage

Tags:

I have a Lamp Docker Image. I want to start 500 containers of this image, how many RAM i need? I have tracked memory usage of each new container and it nearly the same as any other container of its image. So,if single container is using 200 MB, I can start 5 containers on Linux machine with 1 GB RAM.

My question is:

Is docker container using same memory as, for example, same Virtual Machine Image? May be I am doing something wrong in docker configuration or docker files?

like image 661
Alex Shuraits Avatar asked Jul 31 '14 11:07

Alex Shuraits


People also ask

How much memory does a docker container use?

The minimum allowed value is 4m . Because kernel memory cannot be swapped out, a container which is starved of kernel memory may block host machine resources, which can have side effects on the host machine and on other containers.

How do I check my docker memory usage?

If you need more detailed information about a container's resource usage, use the /containers/(id)/stats API endpoint. On Linux, the Docker CLI reports memory usage by subtracting cache usage from the total memory usage.

How do I get the memory of a docker container?

You can look it up with docker inspect or docker ps --no-trunc . Putting everything together to look at the memory metrics for a Docker container, take a look at the following paths: /sys/fs/cgroup/memory/docker/<longid>/ on cgroup v1, cgroupfs driver. /sys/fs/cgroup/memory/system.

Does docker consume RAM?

Docker does not apply memory limitations to containers by default. The Host's Kernel Scheduler determines the capacity provided to the Docker memory. This means that in theory, it is possible for a Docker container to consume the entire host's memory.


1 Answers

docker stats might give you the feedback you need. https://docs.docker.com/engine/reference/commandline/stats/

like image 84
Dan Tanner Avatar answered Sep 20 '22 15:09

Dan Tanner