Docker: what are negative impacts of running container with memory limit enabled and memory overcommit disabled?

In my environment, I am going to disable the memory overcommit (vm.overcommit=2). This disables Linux OOMKiller also.

The reason is that I run Java apps in docker containers with properly memory size limitation and I want to see them failing with OOMError (and writing heap dump) instead of just killed silently by linux OOMKiller.

  • Cannot download docker images behind proxy : Timeout : Docker for Mac
  • How can I save my RSA KEY in my Docker Machine?
  • Unable to run mariadb when mount volume
  • How to remove docker images based on name?
  • CannotStartContainerError with node:6.7.0-wheezy on AWS
  • Cant get AngularJS site running in Docker Container
  • Iam not sure about possible negative impacts of that. I am not a Linux kernel, docker memory management or Java VM expert, so decided to ask here.

    If anyone has such experience, can you please tell me?

  • Running docker securely
  • Script run inside docker container reporting significantly higher memory than outside
  • Docker-compose: Can I automate compose to run commands inside a container?
  • Tutum Redeploy trigger doesn't rebuild from image
  • Dockerized Rails 5 RC1 application not picking up updates to controllers and models in development
  • Swarm rescheduling after adding new node
  • One Solution collect form web for “Docker: what are negative impacts of running container with memory limit enabled and memory overcommit disabled?”

    If you disable memory overcommit, then if the JVM requests memory from the OS and all memory is committed, then the syscall will fail. When that happens, the JVM to fail with an OOME and the message that includes “Out of swap space?”.

    My reading of the Oracle OOME troubleshooting documentation is that this will cause an fatal error logfile to be written. It is not clear if a heap dump can be created.

    If you are trying to track down a suspected memory leak, I would suggest setting the initial heap and max heap sizes to be the same value, and make them small enough that you don’t get an “Out of swap space?” OOME. If you get a “normal” OOME, you should be able to get a heap dump.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.