mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Always umount container rootfs and volumes on docker cp failed
Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
parent
270d7e1af8
commit
13c36ce65e
1 changed files with 3 additions and 2 deletions
|
@ -622,11 +622,12 @@ func (container *Container) Copy(resource string) (io.ReadCloser, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, m := range mounts {
|
for _, m := range mounts {
|
||||||
dest, err := container.GetResourcePath(m.Destination)
|
var dest string
|
||||||
|
dest, err = container.GetResourcePath(m.Destination)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue