health checks: restart timers

Restart the health-check timers instead of starting them.  This will
surpress annoying errors stating that an already running timer cannot be
started anymore.

Also make sure that the transient units/timers are stopped and removed
when stopping a container.

Fixes: #15691
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2022-09-12 15:22:21 +02:00
parent 1635fe8620
commit c8c2aab50d
3 changed files with 9 additions and 5 deletions

View File

@ -1286,6 +1286,12 @@ func (c *Container) stop(timeout uint) error {
c.lock.Unlock()
}
if c.config.HealthCheckConfig != nil {
if err := c.removeTransientFiles(context.Background()); err != nil {
logrus.Error(err.Error())
}
}
stopErr := c.ociRuntime.StopContainer(c, timeout, all)
if !c.batched {