Merge pull request #28047 from cpuguy83/27773_chrootarchive_rbind

Fix issue with cp to container volume dir
This commit is contained in:
Michael Crosby 2016-11-09 10:52:14 -08:00 committed by GitHub
commit da0ccf8e61
1 changed files with 5 additions and 3 deletions

View File

@ -30,9 +30,11 @@ func chroot(path string) (err error) {
if err := mount.MakeRPrivate("/"); err != nil {
return err
}
// ensure path is a mountpoint
if err := mount.MakePrivate(path); err != nil {
return err
if mounted, _ := mount.Mounted(path); !mounted {
if err := mount.Mount(path, path, "bind", "rbind,rw"); err != nil {
return realChroot(path)
}
}
// setup oldRoot for pivot_root