From 6baf6e461de6e560cc48d35239e7c392bec4481c Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Mon, 8 Jan 2018 11:41:01 -0500 Subject: Clean up network namespaces on container removal Signed-off-by: Matthew Heon Closes: #197 Approved by: rhatdan --- libpod/runtime_ctr.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libpod') diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 9e42ff8d1..914d457a0 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -139,6 +139,11 @@ func (r *Runtime) removeContainer(c *Container, force bool) error { return errors.Wrapf(ErrCtrStateInvalid, "cannot remove container %s as it is %s - running or paused containers cannot be removed", c.ID(), c.state.State.String()) } + // Stop the container's network namespace (if it has one) + if err := r.teardownNetNS(c); err != nil { + return err + } + // Stop the container's storage if err := c.teardownStorage(); err != nil { return err -- cgit v1.2.3-54-g00ecf