Provide Out Of Memory information in container status

Container processes can get killed by the kernel whenever they exceed their memory limit or when the overall memory available in the system is very low. When containers get killed by the kernel, there is no way to figure out if it died due to lack of memory.
To solve this problem, this patch modified docker to Identify out of memory kills inside containers and indicate that as part of the container status string. Since some containers can gracefully handle OOM kills, this patch does not attempt to bring down a container whenever an OOM occurs.

Ping @crosbymichael @vieux 
cc @bgrant0607
yup. If we refactor libcontainer to make that happen.

On Thu, Oct 30, 2014 at 5:33 PM, Alexandr Morozov <notifications@github.com>
wrote:

> In daemon/execdriver/native/driver.go:
>
> > +				startCallback(&c.ProcessConfig, c.ContainerPid)
> > +			}
> > +		})
> > +		execOutputChan <- execOutput{exitCode, err}
> > +	}()
> > +
> > +	select {
> > +	case execOutput := <-execOutputChan:
> > +		return &execdriver.ExitStatus{execOutput.exitCode, false}, execOutput.err
> > +	case <-waitForStart:
> > +		break
> > +	}
> > +
> > +	oomKill := false
> > +	oomKillNotification, err := d.notifyOnOOM(container)
> > +	if err == nil {
>
> So, just for clearing situation - here we don't need notify, we know when
> process died - we can just read memory.oom_control? This is of course for
> future optimizations.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/docker/docker/pull/8479/files#r19645942>.
>