From ecf88f17b6a061fcf6949abba07ba8be8101ee42 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 12 Aug 2024 11:47:23 +0200 Subject: [PATCH] libpod: reset state error on init If we manage to init/start a container successfully we should unset any previously stored state errors. Otherwise a user might be confused why there is an error in the state about some old error even though the container works/runs. Signed-off-by: Paul Holzinger --- libpod/container_internal.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index d12b2809fc..50acaf3e7f 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1106,6 +1106,9 @@ func (c *Container) init(ctx context.Context, retainRetries bool) error { c.state.RestoreLog = "" c.state.ExitCode = 0 c.state.Exited = false + // Reset any previous errors as we try to init it again, either it works and we don't + // want to keep an old error around or a new error will be written anyway. + c.state.Error = "" c.state.State = define.ContainerStateCreated c.state.StoppedByUser = false c.state.RestartPolicyMatch = false