mirror of
https://github.com/containers/podman.git
synced 2025-06-24 11:28:24 +08:00
podman stop always cleanup
When a container is configured for auto removal podman stop should still do cleanup, there is no guarantee the the cleanup process spawned by conmon will be successful. Also a user expects after podman stop that the network/mounts are cleaned up. Therefore podman stop should not return early and instead do the cleanup and ignore errors if the container was already removed. [NO TESTS NEEDED] I don't know how to test this. Fixes #11384 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -173,13 +173,17 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.AutoRemove() {
|
err = c.Cleanup(ctx)
|
||||||
// Issue #7384: if the container is configured for
|
if err != nil {
|
||||||
// auto-removal, it might already have been removed at
|
// Issue #7384 and #11384: If the container is configured for
|
||||||
// this point.
|
// auto-removal, it might already have been removed at this point.
|
||||||
return nil
|
// We still need to to cleanup since we do not know if the other cleanup process is successful
|
||||||
|
if c.AutoRemove() && (errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved)) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
return c.Cleanup(ctx)
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Reference in New Issue
Block a user