Substract bindmount path from cgroup dir

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov
2015-07-15 10:41:25 -07:00
parent 42aa891a6b
commit 40b9b89107
2 changed files with 9 additions and 4 deletions
+7 -3
View File
@@ -180,18 +180,22 @@ func mountToRootfs(m *configs.Mount, rootfs, mountLabel string) error {
if err != nil {
return err
}
relDir, err := filepath.Rel(mm.Root, dir)
if err != nil {
return err
}
binds = append(binds, &configs.Mount{
Device: "bind",
Source: filepath.Join(mm.Mountpoint, dir),
Source: filepath.Join(mm.Mountpoint, relDir),
Destination: filepath.Join(m.Destination, strings.Join(mm.Subsystems, ",")),
Flags: syscall.MS_BIND | syscall.MS_REC | m.Flags,
})
}
tmpfs := &configs.Mount{
Device: "tmpfs",
Source: "tmpfs",
Device: "tmpfs",
Destination: m.Destination,
Flags: syscall.MS_NOEXEC | syscall.MS_NOSUID | syscall.MS_NODEV,
Flags: defaultMountFlags,
}
if err := mountToRootfs(tmpfs, rootfs, mountLabel); err != nil {
return err