1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

chroot: remount everything as private in new mntns

If parent of the destination path is shared, this
path will be unmounted from the parent ns even if
the path itself is private.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit b511d1f0ca)
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Tonis Tiigi 2016-10-20 15:29:23 -07:00 committed by Victor Vieux
parent 3f21a28ec0
commit a8ffa0128c

View file

@ -21,7 +21,12 @@ func chroot(path string) (err error) {
return fmt.Errorf("Error creating mount namespace before pivot: %v", err)
}
if err := mount.MakeRPrivate(path); err != nil {
// make everything in new ns private
if err := mount.MakeRPrivate("/"); err != nil {
return err
}
// ensure path is a mountpoint
if err := mount.MakePrivate(path); err != nil {
return err
}