Stopping a stopped container should not be an error

Resolves: #575

Signed-off-by: baude <bbaude@redhat.com>

Closes: #588
Approved by: mheon
This commit is contained in:
baude
2018-04-03 10:43:58 -05:00
committed by Atomic Bot
parent 4640e79667
commit b1a8d769b8
2 changed files with 9 additions and 1 deletions

View File

@ -215,6 +215,10 @@ func (c *Container) Stop() error {
return errors.Wrapf(ErrCtrStateInvalid, "can only stop created, running, or stopped containers")
}
if c.state.State == ContainerStateStopped {
return ErrCtrStopped
}
return c.stop(c.config.StopTimeout)
}
@ -237,6 +241,10 @@ func (c *Container) StopWithTimeout(timeout uint) error {
return errors.Wrapf(ErrCtrStateInvalid, "can only stop created, running, or stopped containers")
}
if c.state.State == ContainerStateStopped {
return ErrCtrStopped
}
return c.stop(timeout)
}