mirror of https://github.com/docker/docs.git
Merge pull request #25178 from crosbymichael/bump-restore
Check if the container is running if no event
This commit is contained in:
commit
cd22bb863c
|
|
@ -505,13 +505,21 @@ func (clnt *client) Restore(containerID string, options ...CreateOption) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If ev is nil, then we already consumed all the event of the
|
if ev == nil {
|
||||||
|
if _, err := clnt.getContainer(containerID); err == nil {
|
||||||
|
// If ev is nil and the container is running in containerd,
|
||||||
|
// we already consumed all the event of the
|
||||||
// container, included the "exit" one.
|
// container, included the "exit" one.
|
||||||
// Thus we return to avoid overriding the Exit Code.
|
// Thus we return to avoid overriding the Exit Code.
|
||||||
if ev == nil {
|
|
||||||
logrus.Warnf("libcontainerd: restore was called on a fully synced container (%s)", containerID)
|
logrus.Warnf("libcontainerd: restore was called on a fully synced container (%s)", containerID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
// the container is not running so we need to fix the state within docker
|
||||||
|
ev = &containerd.Event{
|
||||||
|
Type: StateExit,
|
||||||
|
Status: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// get the exit status for this container
|
// get the exit status for this container
|
||||||
ec := uint32(0)
|
ec := uint32(0)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue