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.
Asked
Active
Viewed 1,173 times
1
-
Which _memory address_? – tkausl Jul 11 '18 at 04:06
-
Don't know about memory addresses but have you read [this](https://stackoverflow.com/questions/24702233/docker-container-and-memory-consumption)? – Teemu Risikko Jul 11 '18 at 04:51
-
It doesn't. The OS kernel manages the memory location of processes.running in the container. – Henry Jul 11 '18 at 05:08
-
So you mean the memory space of each process running in containers is allocated and managed by the OS. Then why can't we use `ps` command to see the process? Or how does the container in docker tell OS that there is a process needed to be allocated memory space? – Luba A Jul 11 '18 at 05:54
-
@Henry is correct but you can define a memory per container by docker run -d -t --memory="512m" – Frodo Jul 11 '18 at 06:46
-
This article: [What even is a container: namespaces and cgroups](https://jvns.ca/blog/2016/10/10/what-even-is-a-container/) by Julia Evans has some interesting things that may help you. – tgogos Jul 11 '18 at 06:55
2 Answers
3
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.

farzad
- 8,775
- 6
- 32
- 41
0
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?

meliora245
- 53
- 1
- 3