title: Docker reserve a certain amount of memory for container
body: <p>I'm running <code>npm</code> inside a docker container and every so often it aborts because it cannot allocate enough memory. I see some flags like <code>--memory</code> (<a href="https://stackoverflow.com/questions/16084741/how-do-i-set-resources-allocated-to-a-container-using-docker">How do I set resources allocated to a container using docker?</a>) for the <code>docker run</code> command that seem to limit the maximum amount of memory that a container can consume, but haven't seen anything yet that would allow me to reserve an amount of memory for the container and abort immediately if it cannot be allocated.</p>