... | ... |
@@ -67,10 +67,14 @@ func (docker *Docker) Destroy(container *Container) error { |
67 | 67 |
if err := container.Stop(); err != nil { |
68 | 68 |
return err |
69 | 69 |
} |
70 |
+ if container.Filesystem.IsMounted() { |
|
71 |
+ if err := container.Filesystem.Umount(); err != nil { |
|
72 |
+ log.Printf("Unable to umount container %v: %v", container.Id, err) |
|
73 |
+ } |
|
74 |
+ } |
|
70 | 75 |
if err := os.RemoveAll(container.Root); err != nil { |
71 |
- return err |
|
76 |
+ log.Printf("Unable to remove filesystem for %v: %v", container.Id, err) |
|
72 | 77 |
} |
73 |
- |
|
74 | 78 |
docker.containers.Remove(element) |
75 | 79 |
return nil |
76 | 80 |
} |
... | ... |
@@ -58,6 +58,8 @@ func (fs *Filesystem) Umount() error { |
58 | 58 |
if fs.IsMounted() { |
59 | 59 |
return fmt.Errorf("Umount: Filesystem still mounted after calling umount(%v)", fs.RootFS) |
60 | 60 |
} |
61 |
+ // Even though we just unmounted the filesystem, AUFS will prevent deleting the mntpoint |
|
62 |
+ // for some time. We'll just keep retrying until it succeeds. |
|
61 | 63 |
for retries := 0; retries < 1000; retries++ { |
62 | 64 |
err := os.Remove(fs.RootFS) |
63 | 65 |
if err == nil { |