Skip to content

Commit 4af4f40

Browse files
committed
[fix] execute prepareRootfs for a new mount namespace only
1 parent e40d463 commit 4af4f40

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libcontainer/standard_init_linux.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ func (l *linuxStandardInit) Init() error {
7878
}
7979

8080
label.Init()
81-
if err := prepareRootfs(l.pipe, l.config); err != nil {
82-
return err
81+
// prepareRootfs() can be executed only for a new mount namespace.
82+
if l.config.Config.Namespaces.Contains(configs.NEWNS) {
83+
if err := prepareRootfs(l.pipe, l.config); err != nil {
84+
return err
85+
}
8386
}
8487
// Set up the console. This has to be done *before* we finalize the rootfs,
8588
// but *after* we've given the user the chance to set up all of the mounts

0 commit comments

Comments
 (0)