From fa7000a5bc2f1454dec56e575bd21196fdae2fba Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Wed, 17 Jun 2015 16:50:17 -0400 Subject: [PATCH] Use nsenter on PATH in container, and separate args nsenter needs '--' to separate calls --- pkg/util/mount/nsenter_mount.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/util/mount/nsenter_mount.go b/pkg/util/mount/nsenter_mount.go index 0d5dae381fe..b6671b52374 100644 --- a/pkg/util/mount/nsenter_mount.go +++ b/pkg/util/mount/nsenter_mount.go @@ -54,7 +54,7 @@ var _ = Interface(&NsenterMounter{}) const ( hostRootFsPath = "/rootfs" hostProcMountsPath = "/rootfs/proc/mounts" - nsenterPath = "/nsenter" + nsenterPath = "nsenter" ) // Mount runs mount(8) in the host's root mount namespace. Aside from this @@ -94,6 +94,7 @@ func doNsenterMount(source, target, fstype string, options []string) error { func makeNsenterArgs(source, target, fstype string, options []string) []string { nsenterArgs := []string{ "--mount=/rootfs/proc/1/ns/mnt", + "--", "/usr/bin/mount", } @@ -106,6 +107,7 @@ func makeNsenterArgs(source, target, fstype string, options []string) []string { func (*NsenterMounter) Unmount(target string) error { args := []string{ "--mount=/rootfs/proc/1/ns/mnt", + "--", "/usr/bin/umount", target, } @@ -133,7 +135,7 @@ func (*NsenterMounter) IsMountPoint(file string) (bool, error) { return false, err } - args := []string{"--mount=/rootfs/proc/1/ns/mnt", "/usr/bin/findmnt", "-o", "target", "--noheadings", "--target", file} + args := []string{"--mount=/rootfs/proc/1/ns/mnt", "--", "/usr/bin/findmnt", "-o", "target", "--noheadings", "--target", file} glog.V(5).Infof("findmnt command: %v %v", nsenterPath, args) exec := exec.New()