mirror of https://github.com/containers/podman.git
Restart policy should not run if a container is running
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
parent
948fb5ee64
commit
56356d7027
|
@ -221,6 +221,14 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Is the container running again?
|
||||||
|
// If so, we don't have to do anything
|
||||||
|
if c.state.State == ContainerStateRunning || c.state.State == ContainerStatePaused {
|
||||||
|
return nil
|
||||||
|
} else if c.state.State == ContainerStateUnknown {
|
||||||
|
return errors.Wrapf(ErrInternal, "invalid container state encountered in restart attempt!")
|
||||||
|
}
|
||||||
|
|
||||||
// Increment restart count
|
// Increment restart count
|
||||||
c.state.RestartCount = c.state.RestartCount + 1
|
c.state.RestartCount = c.state.RestartCount + 1
|
||||||
logrus.Debugf("Container %s now on retry %d", c.ID(), c.state.RestartCount)
|
logrus.Debugf("Container %s now on retry %d", c.ID(), c.state.RestartCount)
|
||||||
|
|
Loading…
Reference in New Issue