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.

  • Docker: access to VPN domain from docker
  • Cross-device link not permitted Error in Meteor Project with Docker
  • Docker Fluentd Logging Driver For multiline
  • Debian : Using a cron task on Docker
  • What are the correct Permissions for docker in docker as another user?
  • FeignClient With Client Certificate And Docker
  • 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?

  • How to Ssh into docker container that is running inside Vagrant?
  • Docker slow non-local database access
  • Bash in docker container has weird behaviour: “prompt jumps around”
  • Docker Remote API JSON schema definition
  • How to Create MongoDB cluster as Docker Containers
  • Angular2 docker setup for multiple environments
  • 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.