What happens if a container need more RAM available on host?

I’m a very newbie of Docker and I’m learning it and planning to dockerize our processes.
One of the process that will be migrated to Docker consume a lot of RAM.
In the current setup, to avoid that linux kernel kill that process I have to setup a virtual machine with a big swap file.

I’m wondering how to handle such situations with Docker.
So supposing I have an host with 2Gb of RAM on which is running a container with a process allocating 4Gb (or more). What happens ? How Docker engine handles that situations ?


Docker doesn’t do anything. The kernel sees it as a normal process, and will OOM kill it. If you started the container with a --restart option, Docker might try to restart it after it gets killed. If swap is the answer for you, then add the swap space on the host as normal.