mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
daemon: identify container exits by ProcessID
The Pid field of an exit event cannot be relied upon to differentiate exits of the container's task from exits of other container processes, i.e. execs. The Pid is reported by the runtime and is implementation- defined so there is no guarantee that a task's pid is distinct from the pids of any other process in the same container. In particular, kata-containers reports the pid of the hypervisor for all exit events. ContainerD guarantees that the process ID of a task is set to the corresponding container ID, so use that invariant to distinguish task exits from other process exits. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
@@ -156,7 +156,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei
|
||||
|
||||
daemon.LogContainerEvent(c, "oom")
|
||||
case libcontainerdtypes.EventExit:
|
||||
if int(ei.Pid) == c.Pid {
|
||||
if ei.ProcessID == ei.ContainerID {
|
||||
return daemon.handleContainerExit(c, &ei)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user