mirror of https://github.com/containers/podman.git
Sending signals to containers prevents restart policy
Noticed this when testing some behavior with Docker. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
parent
0d73ee40b2
commit
dc42304f38
|
@ -199,8 +199,15 @@ func (c *Container) Kill(signal uint) error {
|
||||||
if c.state.State != ContainerStateRunning {
|
if c.state.State != ContainerStateRunning {
|
||||||
return errors.Wrapf(ErrCtrStateInvalid, "can only kill running containers")
|
return errors.Wrapf(ErrCtrStateInvalid, "can only kill running containers")
|
||||||
}
|
}
|
||||||
|
|
||||||
defer c.newContainerEvent(events.Kill)
|
defer c.newContainerEvent(events.Kill)
|
||||||
return c.runtime.ociRuntime.killContainer(c, signal)
|
if err := c.runtime.ociRuntime.killContainer(c, signal); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
c.state.StoppedByUser = true
|
||||||
|
|
||||||
|
return c.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec starts a new process inside the container
|
// Exec starts a new process inside the container
|
||||||
|
|
|
@ -364,6 +364,13 @@ func (p *Pod) Kill(signal uint) (map[string]error, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Debugf("Killed container %s with signal %d", ctr.ID(), signal)
|
logrus.Debugf("Killed container %s with signal %d", ctr.ID(), signal)
|
||||||
|
|
||||||
|
ctr.state.StoppedByUser = true
|
||||||
|
if err := ctr.save(); err != nil {
|
||||||
|
ctrErrors[ctr.ID()] = err
|
||||||
|
}
|
||||||
|
|
||||||
|
ctr.lock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ctrErrors) > 0 {
|
if len(ctrErrors) > 0 {
|
||||||
|
|
Loading…
Reference in New Issue