mirror of
https://github.com/docker/docs.git
synced 2026-03-27 14:28:47 +07:00
libcontainerd: mark container exited after failed restart
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> (cherry picked from commit 9be0fb45c25e4d8d3cf0aa444da5ae41dd18f435) Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
@@ -190,6 +190,11 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
||||
ctr.client.lock(ctr.containerID)
|
||||
defer ctr.client.unlock(ctr.containerID)
|
||||
ctr.restarting = false
|
||||
if err == nil {
|
||||
if err = ctr.start(); err != nil {
|
||||
logrus.Errorf("libcontainerd: error restarting %v", err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
st.State = StateExit
|
||||
ctr.clean()
|
||||
@@ -201,8 +206,6 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
||||
if err != restartmanager.ErrRestartCanceled {
|
||||
logrus.Errorf("libcontainerd: %v", err)
|
||||
}
|
||||
} else {
|
||||
ctr.start()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@@ -256,14 +256,16 @@ func (ctr *container) waitExit(process *process, isFirstProcessToStart bool) err
|
||||
err := <-waitRestart
|
||||
ctr.restarting = false
|
||||
ctr.client.deleteContainer(ctr.friendlyName)
|
||||
if err == nil {
|
||||
if err = ctr.client.Create(ctr.containerID, ctr.ociSpec, ctr.options...); err != nil {
|
||||
logrus.Errorf("libcontainerd: error restarting %v", err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
si.State = StateExit
|
||||
if err := ctr.client.backend.StateChanged(ctr.containerID, si); err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
logrus.Error(err)
|
||||
} else {
|
||||
ctr.client.Create(ctr.containerID, ctr.ociSpec, ctr.options...)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user