summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 60e83576a..c2ed67a82 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -561,8 +561,11 @@ func (c *Container) cleanupRuntime(ctx context.Context) error {
// Our state is now Exited, as we've removed ourself from
// the runtime.
c.state.State = ContainerStateExited
- if err := c.save(); err != nil {
- return err
+
+ if c.valid {
+ if err := c.save(); err != nil {
+ return err
+ }
}
logrus.Debugf("Successfully cleaned up container %s", c.ID())