summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-02-06 16:51:05 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2018-02-08 06:42:21 -0500
commit3921f10a729054c23296f392b0f271c1ac5e5770 (patch)
treeb129bb402157b23eb4f8228818cc94d87b9fd88b /libpod/container_internal.go
parent8fdccb77648f5b772c6bae98fce4734b1a54ed4a (diff)
downloadpodman-3921f10a729054c23296f392b0f271c1ac5e5770.tar.gz
podman-3921f10a729054c23296f392b0f271c1ac5e5770.tar.bz2
podman-3921f10a729054c23296f392b0f271c1ac5e5770.zip
cleanup network stack as well as storage when container shuts down.
This patch will cleanup the network stack when the container exits Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 77e456fe1..d434630a3 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -365,6 +365,19 @@ func (c *Container) mountStorage() (err error) {
return c.save()
}
+// cleanupNetwork unmounts and cleans up the container's network
+func (c *Container) cleanupNetwork() error {
+ // Stop the container's network namespace (if it has one)
+ if err := c.runtime.teardownNetNS(c); err != nil {
+ logrus.Errorf("unable cleanup network for container %s: %q", c.ID(), err)
+ }
+
+ c.state.NetNS = nil
+ c.state.SubnetMask = ""
+ c.state.IPAddress = ""
+ return c.save()
+}
+
// cleanupStorage unmounts and cleans up the container's root filesystem
func (c *Container) cleanupStorage() error {
if !c.state.Mounted {