stage1: prepare-app: fix volumes during the root bind-mount

The bind mount on / was introduced by
https://github.com/coreos/rocket/pull/626 to fix the "Docker inside
Rocket" use case in https://github.com/coreos/rocket/issues/638

But this introduced a regression on volume mounted via "rkt run
-volume". This patch fixes the regression.

Regression discovered by Iago when testing Flannel from
https://github.com/coreos/rocket/issues/389
This commit is contained in:
Alban Crequy
2015-03-19 13:08:42 +01:00
parent d870399e5f
commit 9ea9e365b6
+5 -2
View File
@@ -70,8 +70,11 @@ int main(int argc, char *argv[])
/* Make stage2's root a mount point. Chrooting an application in a
* directory which is not a mount point is not nice because the
* application would not be able to remount "/" it as private mount.
* This allows Docker to run inside Rocket. */
pexit_if(mount(root, root, "bind", MS_BIND, NULL) == -1,
* This allows Docker to run inside Rocket.
* The recursive flag is to preserve volumes mounted previously by
* systemd-nspawn via "rkt run -volume".
* */
pexit_if(mount(root, root, "bind", MS_BIND | MS_REC, NULL) == -1,
"Make / a mount point failed");
rootfd = open(root, O_DIRECTORY | O_CLOEXEC);