From 0017a6110f4e9ebe244503f5d0b8959df6292e85 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Fri, 1 Apr 2016 18:24:35 +0800 Subject: [PATCH] ensure the container see the mount point of the rootfs Signed-off-by: Lai Jiangshan --- src/container.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/container.c b/src/container.c index 8959875..dd2e281 100644 --- a/src/container.c +++ b/src/container.c @@ -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);