From 13c36ce65ec02c7d2ac564ccc9d4f69e92760d9a Mon Sep 17 00:00:00 2001 From: Lei Jitang Date: Tue, 7 Jul 2015 20:27:45 +0800 Subject: [PATCH] Always umount container rootfs and volumes on docker cp failed Signed-off-by: Lei Jitang --- daemon/container.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/daemon/container.go b/daemon/container.go index f922a43f1b..6292fd365f 100644 --- a/daemon/container.go +++ b/daemon/container.go @@ -622,11 +622,12 @@ func (container *Container) Copy(resource string) (io.ReadCloser, error) { return nil, err } for _, m := range mounts { - dest, err := container.GetResourcePath(m.Destination) + var dest string + dest, err = container.GetResourcePath(m.Destination) if err != nil { return nil, err } - if err := mount.Mount(m.Source, dest, "bind", "rbind,ro"); err != nil { + if err = mount.Mount(m.Source, dest, "bind", "rbind,ro"); err != nil { return nil, err } }