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 <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2024-08-13 17:37:03 +02:00
parent 8a943311db
commit 30eb6b6aae
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
1 changed files with 5 additions and 0 deletions

View File

@ -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)