ensure the container see the mount point of the rootfs

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan
2016-04-01 18:24:35 +08:00
parent 6feb864e30
commit 0017a6110f
+4
View File
@@ -420,6 +420,10 @@ static int hyper_container_init(void *data)
}
/* reuse oldroot array */
sprintf(oldroot, "%s/%s/", root, container->rootfs);
if (mount(oldroot, oldroot, NULL, MS_BIND|MS_REC, NULL) < 0) {
perror("failed to bind rootfs");
goto fail;
}
/* pivot_root won't work, see
* Documention/filesystem/ramfs-rootfs-initramfs.txt */
chroot(oldroot);