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.

  • Difference between containers (Docker) and IIS
  • Clone and run laravel application easily
  • Installing docker-ce through puppet
  • can't npm install bcrypt in my docker image
  • Requests hanging on ports forwarded from docker container inside vagrant
  • Docker + ELK stack taking up more space than it should
  • 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?

  • Trouble running docker registry in insecure mode on Ubuntu 16.04
  • How to use port forwarding to connect to docker container using DNS name
  • Kubernetes: how to use gitRepo volume?
  • Foreground process in docker.io container
  • Docker terminal on windows 10: does clipboard work?
  • How to uninstall Docker Machine under Windows 10
  • 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.