mirror of https://github.com/docker/docs.git
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:
parent
f6d388f5b1
commit
c473d14d45
|
|
@ -190,6 +190,11 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
||||||
ctr.client.lock(ctr.containerID)
|
ctr.client.lock(ctr.containerID)
|
||||||
defer ctr.client.unlock(ctr.containerID)
|
defer ctr.client.unlock(ctr.containerID)
|
||||||
ctr.restarting = false
|
ctr.restarting = false
|
||||||
|
if err == nil {
|
||||||
|
if err = ctr.start(); err != nil {
|
||||||
|
logrus.Errorf("libcontainerd: error restarting %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
st.State = StateExit
|
st.State = StateExit
|
||||||
ctr.clean()
|
ctr.clean()
|
||||||
|
|
@ -201,8 +206,6 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
||||||
if err != restartmanager.ErrRestartCanceled {
|
if err != restartmanager.ErrRestartCanceled {
|
||||||
logrus.Errorf("libcontainerd: %v", err)
|
logrus.Errorf("libcontainerd: %v", err)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ctr.start()
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -256,14 +256,16 @@ func (ctr *container) waitExit(process *process, isFirstProcessToStart bool) err
|
||||||
err := <-waitRestart
|
err := <-waitRestart
|
||||||
ctr.restarting = false
|
ctr.restarting = false
|
||||||
ctr.client.deleteContainer(ctr.friendlyName)
|
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 {
|
if err != nil {
|
||||||
si.State = StateExit
|
si.State = StateExit
|
||||||
if err := ctr.client.backend.StateChanged(ctr.containerID, si); err != nil {
|
if err := ctr.client.backend.StateChanged(ctr.containerID, si); err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
}
|
}
|
||||||
logrus.Error(err)
|
|
||||||
} else {
|
|
||||||
ctr.client.Create(ctr.containerID, ctr.ociSpec, ctr.options...)
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue