summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpod/container_internal.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 76de37a09..22ed34987 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -221,6 +221,14 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (err error) {
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
c.state.RestartCount = c.state.RestartCount + 1
logrus.Debugf("Container %s now on retry %d", c.ID(), c.state.RestartCount)