ctr: Allow deleting a container in the Created state
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
4d14bfd8ad
commit
8e12d1fcad
@ -40,12 +40,12 @@ var deleteCommand = cli.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if status == containerd.Stopped {
|
if status == containerd.Stopped || status == containerd.Created {
|
||||||
if _, err := task.Delete(ctx); err != nil {
|
if _, err := task.Delete(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return container.Delete(ctx, deleteOpts...)
|
return container.Delete(ctx, deleteOpts...)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("cannot delete a container with an existing task")
|
return fmt.Errorf("cannot delete a non stopped container: %v", status)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user