From 32753c3d241c9238b2a34f61fd44399453d7b455 Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Mon, 27 Jan 2014 17:19:38 +0000 Subject: [PATCH] Fix for issue #3786 This is a fix for the case that one mount is inside another mount and docker can't then delete the resulting container. Docker-DCO-1.1-Signed-off-by: Peter Waller (github: pwaller) --- container.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/container.go b/container.go index aafda78bc7..c5df1f4b58 100644 --- a/container.go +++ b/container.go @@ -1365,9 +1365,9 @@ func (container *Container) Unmount() error { mounts = append(mounts, path.Join(root, r)) } - for _, m := range mounts { - if lastError := mount.Unmount(m); lastError != nil { - err = lastError + for i := len(mounts) - 1; i >= 0; i-- { + if lastError := mount.Unmount(mounts[i]); lastError != nil { + err = fmt.Errorf("Failed to umount %v: %v", mounts[i], lastError) } } if err != nil {