ctr: Allow deleting a container in the Created state

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-07-20 08:24:59 +02:00
parent 4d14bfd8ad
commit 8e12d1fcad
No known key found for this signature in database
GPG Key ID: 40CF16616B361216

View File

@ -40,12 +40,12 @@ var deleteCommand = cli.Command{
if err != nil {
return err
}
if status == containerd.Stopped {
if status == containerd.Stopped || status == containerd.Created {
if _, err := task.Delete(ctx); err != nil {
return err
}
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)
},
}