mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
05b611574f
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
19 lines
396 B
Go
19 lines
396 B
Go
// +build linux
|
|
|
|
package mount
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/dotcloud/docker/pkg/system"
|
|
"syscall"
|
|
)
|
|
|
|
func MsMoveRoot(rootfs string) error {
|
|
if err := system.Mount(rootfs, "/", "", syscall.MS_MOVE, ""); err != nil {
|
|
return fmt.Errorf("mount move %s into / %s", rootfs, err)
|
|
}
|
|
if err := system.Chroot("."); err != nil {
|
|
return fmt.Errorf("chroot . %s", err)
|
|
}
|
|
return system.Chdir("/")
|
|
}
|