summaryrefslogtreecommitdiffhomepage
path: root/runsc/cmd/delete.go
diff options
context:
space:
mode:
authorLantao Liu <lantaol@google.com>2018-09-06 11:04:58 -0700
committerShentubot <shentubot@google.com>2018-09-06 11:06:19 -0700
commit4f3053cb4e4ec408efdce6c7174e847ae71f2f88 (patch)
tree1b0d580cfa762df150c9411315b4ae3e2a7c8ddd /runsc/cmd/delete.go
parentefac28976c6dbf40627d02753fee1467c8272b45 (diff)
runsc: do not delete in paused state.
PiperOrigin-RevId: 211835570 Change-Id: Ied7933732cad5bc60b762e9c964986cb49a8d9b9
Diffstat (limited to 'runsc/cmd/delete.go')
-rw-r--r--runsc/cmd/delete.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/runsc/cmd/delete.go b/runsc/cmd/delete.go
index 46de5f348..92b609c3c 100644
--- a/runsc/cmd/delete.go
+++ b/runsc/cmd/delete.go
@@ -76,8 +76,8 @@ func (d *Delete) execute(ids []string, conf *boot.Config) error {
}
return fmt.Errorf("error loading container %q: %v", id, err)
}
- if !d.force && (c.Status == container.Running) {
- return fmt.Errorf("cannot stop running container without --force flag")
+ if !d.force && c.Status != container.Created && c.Status != container.Stopped {
+ return fmt.Errorf("cannot delete container that is not stopped without --force flag")
}
if err := c.Destroy(); err != nil {
return fmt.Errorf("error destroying container: %v", err)