Change:
} waiting = false } else if !inspectResult.State.FinishedAt.IsZero() { <del> // TODO(dchen1107): Integrate with event to provide a better reason </del> <ins> reason := "" // Note: An application might handle OOMKilled gracefully. // In that case, the container is oom killed, but the exit // code could be 0. if inspectResult.State.OOMKilled { reason = "OOM Killed" } else { reason = inspectResult.State.Error } </ins> containerStatus.State.Termination = &api.ContainerStateTerminated{ ExitCode:   inspectResult.State.ExitCode, <del> Reason:     "", </del> <ins> Reason:     reason, </ins> StartedAt:  util.NewTime(inspectResult.State.StartedAt), FinishedAt: util.NewTime(inspectResult.State.FinishedAt), }

Discussion:
docker/docker/pull/8479 was merged and should be available in docker 1.3.2. Kubelete should pick up this newly introduced state from Container status, and propagate it to upper layer.
cc/ I am working on this today. But my initial test with docker is that the feature doesn't work well. I started a container with small memory limit and saw the container was terminated by exit code 137: I ran docker inspect and there is no OOMKilled state at Container State: "State": { "ExitCode": 137, "FinishedAt": "2014-12-16T01:28:15.506537166Z", "Paused": false, "Pid": 0, "Restarting": false, "Running": false, "StartedAt": "2014-12-16T01:28:14.427052134Z" }, I checked kernel log which fill with OOM kill information: Dec 16 01:16:25 kubernetes-minion-2 kernel: [ 2393.] [<] ? pagefaultoutofmemory+0x10/0x80 Dec 16 01:16:25 kubernetes-minion-2 kernel: [ 2393.] Memory cgroup out of memory: Kill process (supervisord) score 2049 or sacrifice child Dec 16 01:16:35 kubernetes-minion-2 kernel: [ 2403.] [<] ? pagefaultoutofmemory+0x10/0x80 Dec 16 01:16:35 kubernetes-minion-2 kernel: [ 2403.] Memory cgroup out of memory: Kill process (supervisord) score 2051 or sacrifice child Dec 16 01:16:45 kubernetes-minion-2 kernel: [ 2413.] [<] ? pagefaultoutofmemory+0x10/0x80 Dec 16 01:16:45 kubernetes-minion-2 kernel: [ 2413.] Memory cgroup out of memory: Kill process (supervisord) score 2062 or sacrifice child Dec 16 01:16:55 kubernetes-minion-2 kernel: [ 2423.] [<] ?

pagefaultoutofmemory+0x10/0x80 Dec 16 01:16:55 kubernetes-minion-2 kernel: [ 2423.] Memory cgroup out of memory: Kill process (supervisord) score 2051 or sacrifice child Dec 16 01:17:05 kubernetes-minion-2 kernel: [ 2433.] [<] ? pagefaultoutofmemory+0x10/0x80 Dec 16 01:17:05 kubernetes-minion-2 kernel: [ 2433.] Memory cgroup out of memory: Kill process (supervisord) score 2036 or sacrifice child Dec 16 01:17:15 kubernetes-minion-2 kernel: [ 2443.] [<] ? pagefaultoutofmemory+0x10/0x80 Dec 16 01:17:15 kubernetes-minion-2 kernel: [ 2443.] Memory cgroup out of memory: Kill process (supervisord) score 2074 or sacrifice child Dec 16 01:17:25 kubernetes-minion-2 kernel: [ 2453.] [<] ? pagefaultoutof_memory+0x10/0x80 The docker I am running is 1.3.3 Which version should include your PR,
The latest version '1.4' has my OOM patches.
This is what I thought, and thanks for confirmation.
may as well update to 1.4, no reason not to do so, we'll get a few weeks of soak before we cut the next release... , Dawn Chen wrote:
I am doing some testing on 1.4 now. I am running into some issues with it, and debugging it. If it is accepted, I will upgrade OSS to docker 1.4, then ask to build new containervm-image later.