From 3c52accbc9c290286f78334765f8b1b0c38140af 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 39c1501da..b0dcc853e 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -392,7 +392,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