title: docker memory-swap=-1 OOM
body: <p>I'm using Ubuntu14.04 and docker1.10.3.</p>
  
  <p>When I execute <code>docker run</code> with <code>--memory-swap -1</code>, I find the memory used of the host machine is beyond the max memory that that container can use and there's no other processes on the host machine that consume much memory. The follwoing image is the test that I conduct on my computer:</p>
  
  <p><a href="https://i.stack.imgur.com/ALfQ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ALfQ8.png" alt="enter image description here"></a></p>
  
  <p>The 1st section is the memory usage on the host machine.<br>
  The 2nd section is the test that is runned in the container to simulating using 900M memory in the container using <a href="http://people.seas.harvard.edu/~apw/stress/" rel="nofollow noreferrer">stress</a>.<br>
  The 3rd section is using <code>docker stats</code> to see the current stats of the container.</p>
  
  <p>I found that although <code>docker stats</code> shows that the container use no more than 104.9M memory, on the host machine the memory used is far more than 104.9M. It seems that <code>--memory-swap -1</code> allows the container uses as much memory as it can.</p>
  
  <p>Is it true?</p>