How docker allocate memory to the process in container?

Docker first initializes a container and then execute the program you want. I wonder how docker manages the memory address of container and the program in it.

2 answers

  • answered 2018-07-11 06:54 farzad

    Docker does not allocate memory, it's the OS that manages the resources used by programs. Docker (internally) uses cgroups which is a kernel service. The reason that ps command (on the host) won't show up processes running in a container, is that containers run in different cgroups which are isolated from each other.

  • answered 2018-07-11 08:34 ephemeral972

    Rather than worrying about the docker memory, you would need to look at the underlying host (VM/instance) where you are running the docker container. The number of containers is determined by a number of factors including what your app is that runs on the container. See here for the limits that you can run into Is there a maximum number of containers running on a Docker host?