summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 2b70afec2..efb4873b0 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -558,6 +558,13 @@ func (c *Container) Init() (err error) {
if err := c.mountStorage(); err != nil {
return err
}
+ defer func() {
+ if err != nil {
+ if err2 := c.cleanupStorage(); err2 != nil {
+ logrus.Errorf("Error cleaning up storage for container %s: %v", c.ID(), err2)
+ }
+ }
+ }()
// Make a network namespace for the container
if c.config.CreateNetNS && c.state.NetNS == nil {