[continue 912] strip rootfs prefix for run in docker (#1058)
* strip rootfs prefix for run in docker * Use `/` as default value of path.rootfs, and parse mounts from `/proc/1/mounts`. * No need to mount `/proc` and `/sys` because we share host's PID namespace, which allows processes within the container to see all of the processes on the system. Closes: #66 Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com> Signed-off-by: Yecheng Fu <cofyc.jackson@gmail.com>
This commit is contained in:
parent
2269df255c
commit
0f9842f20a
4 changed files with 48 additions and 6 deletions
|
|
@ -22,8 +22,9 @@ import (
|
|||
|
||||
var (
|
||||
// The path of the proc filesystem.
|
||||
procPath = kingpin.Flag("path.procfs", "procfs mountpoint.").Default(procfs.DefaultMountPoint).String()
|
||||
sysPath = kingpin.Flag("path.sysfs", "sysfs mountpoint.").Default("/sys").String()
|
||||
procPath = kingpin.Flag("path.procfs", "procfs mountpoint.").Default(procfs.DefaultMountPoint).String()
|
||||
sysPath = kingpin.Flag("path.sysfs", "sysfs mountpoint.").Default("/sys").String()
|
||||
rootfsPath = kingpin.Flag("path.rootfs", "rootfs mountpoint.").Default("/").String()
|
||||
)
|
||||
|
||||
func procFilePath(name string) string {
|
||||
|
|
@ -33,3 +34,7 @@ func procFilePath(name string) string {
|
|||
func sysFilePath(name string) string {
|
||||
return path.Join(*sysPath, name)
|
||||
}
|
||||
|
||||
func rootfsFilePath(name string) string {
|
||||
return path.Join(*rootfsPath, name)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue