From 30eb6b6aaeec82c238bd7eb5fcf54ef57370927e Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 13 Aug 2024 17:37:03 +0200 Subject: [PATCH] libpod: do not stop pod on init ctr exit Init containers are meant to exit early before other containers are started. Thus stopping the infra container in such case is wrong. Signed-off-by: Paul Holzinger --- libpod/container_internal.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 50acaf3e7f..51a0793bb7 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -2163,6 +2163,11 @@ func (c *Container) stopPodIfNeeded(ctx context.Context) error { return nil } + // Never try to stop the pod when a init container stopped + if c.IsInitCtr() { + return nil + } + pod, err := c.runtime.state.Pod(c.config.Pod) if err != nil { return fmt.Errorf("container %s is in pod %s, but pod cannot be retrieved: %w", c.ID(), c.config.Pod, err)