mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00
Allow containers to --restart on-failure with --rm
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -714,3 +714,17 @@ func (c *Container) Restore(ctx context.Context, options ContainerCheckpointOpti
|
||||
defer c.newContainerEvent(events.Restore)
|
||||
return c.restore(ctx, options)
|
||||
}
|
||||
|
||||
// Indicate whether or not the container should restart
|
||||
func (c *Container) ShouldRestart(ctx context.Context) bool {
|
||||
logrus.Debugf("Checking if container %s should restart", c.ID())
|
||||
if !c.batched {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
if err := c.syncContainer(); err != nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return c.shouldRestart()
|
||||
}
|
||||
|
Reference in New Issue
Block a user