I have a server with 16GB RAM. I am trying to set the memory limit to the container by running
docker run -it -m 500M <image-name>
On the docker stats, it shows the container has the memory limit of 500MB. But when i try to do
docker exec -it <containerID> /bin/sh
and do a "top", it shows the available memory as 16GB..
Should it not be set to 500MB ?
The main reason why i need it to be 500 MB is I have java application running in each container. And by default the JVM takes 16gb/64 as the Xms and 4gb as Xmx. :(
I think this article will help you to understand why free and top doesn't work correctly inside containers.
https://fabiokung.com/2014/03/13/memory-inside-linux-containers/