Docker Community Forums

Share and learn in the Docker community.

Memory & CPU allocation for containers


(Bpathak) #1

Hello,

I have a CentOS 7 machine with 12GB of memory & 8 core CPU. I have deployed multiple CentOS containers from docker hub, each running a small application.

I have not specified any memory or CPU parameters as part of the docker run command. How will docker allocate memory & CPU to the containers & manage the requirements for each container.

Is there any documentation/wiki link available which describes the algorithm used by docker?

Thanks
Bhushan Pathak


(Jjfraney) #2

See document on docker run command. https://docs.docker.com/engine/reference/commandline/run/#options especially --cpus and --memory.

By default, docker does not restrict the container by cpu or memory.


(Bpathak) #3

So if docker does not restrict CPU & Memory access, so each docker container gets what it requests for when the container is launched [provided the resources are available].

What will happen if a container requests for more memory resource, say an hour after it is launched, assuming the application within the container is under peak load to serve requests.

Thanks
Bhushan Pathak