From e95f4aa3b0715f87c55a60aa9bf395cbdfc2f3d9 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 5 Feb 2019 15:37:56 -0500 Subject: Preserve exited state across reboot Instead of unconditionally resetting to ContainerStateConfigured after a reboot, allow containers in the Exited state to remain there, preserving their exit code in podman ps after a reboot. This does not affect the ability to use and restart containers after a reboot, as the Exited state can be used (mostly) interchangeably with Configured for starting and managing containers. Signed-off-by: Matthew Heon --- libpod/container_internal.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 0284dde2f..89ca59bbb 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -393,7 +393,9 @@ func resetState(state *containerState) error { state.PID = 0 state.Mountpoint = "" state.Mounted = false - state.State = ContainerStateConfigured + if state.State != ContainerStateExited { + state.State = ContainerStateConfigured + } state.ExecSessions = make(map[string]*ExecSession) state.NetworkStatus = nil state.BindMounts = make(map[string]string) -- cgit v1.2.3-54-g00ecf