Merge pull request #44400 from corhere/backport-22.06/fix-task-delete-on-failed-start
[22.06 backport] Fix containerd task deletion after failed start
This commit is contained in:
commit
4b79d9078a
1 changed files with 3 additions and 1 deletions
|
@ -245,7 +245,9 @@ func (c *client) Start(ctx context.Context, id, checkpointDir string, withStdin
|
|||
close(stdinCloseSync)
|
||||
|
||||
if err := t.Start(ctx); err != nil {
|
||||
if _, err := t.Delete(ctx); err != nil {
|
||||
// Only Stopped tasks can be deleted. Created tasks have to be
|
||||
// killed first, to transition them to Stopped.
|
||||
if _, err := t.Delete(ctx, containerd.WithProcessKill); err != nil {
|
||||
c.logger.WithError(err).WithField("container", id).
|
||||
Error("failed to delete task after fail start")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue