repositorypackage
0.0.0-20170612091819-0aa1e5f7748c
Repository: https://github.com/devatoria/go-nsenter.git
Documentation: pkg.go.dev
# README
go-nsenter
Golang library to execute program into process namespaces using nsenter
.
Example
package main
import (
"fmt"
"github.com/Devatoria/go-nsenter"
)
func main() {
config := &nsenter.Config{
Mount: true, // Execute into mount namespace
Target: 1, // Enter into PID 1 (init) namespace
}
stdout, stderr, err := config.Execute("ls", "-la")
if err != nil {
fmt.Println(stderr)
panic(err)
}
fmt.Println(stdout)
}
Features
- Allow to specify a file to use to enter namespace
- Return stdout/stderr of the executed command