From 681a8c85ed31fcbf6cb3594a791deb418dbf3954 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 29 Nov 2017 10:55:06 -0500 Subject: Ensure that we can't remove paused containers Signed-off-by: Matthew Heon Closes: #85 Approved by: rhatdan --- libpod/runtime_ctr.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libpod') diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 8613950f6..ca9b42575 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -103,6 +103,10 @@ func (r *Runtime) removeContainer(c *Container, force bool) error { return err } + if c.state.State == ContainerStatePaused { + return errors.Wrapf("container %s is paused, cannot remove until unpaused", c.ID()) + } + // Check that the container's in a good state to be removed if c.state.State == ContainerStateRunning && force { if err := r.ociRuntime.stopContainer(c, ctrRemoveTimeout); err != nil { -- cgit v1.2.3-54-g00ecf