https://github.com/devatoria/go-nsenter
Golang library to manipulate namespaces with nsenter
https://github.com/devatoria/go-nsenter
Last synced: about 1 year ago
JSON representation
Golang library to manipulate namespaces with nsenter
- Host: GitHub
- URL: https://github.com/devatoria/go-nsenter
- Owner: Devatoria
- Created: 2017-06-09T08:37:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-11-20T16:40:14.000Z (over 6 years ago)
- Last Synced: 2025-03-24T17:11:06.873Z (over 1 year ago)
- Language: Go
- Size: 4.88 KB
- Stars: 7
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-nsenter
[](https://godoc.org/github.com/Devatoria/go-nsenter)
Golang library to execute program into process namespaces using `nsenter`.
## Example
```go
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
- [X] Allow to specify a file to use to enter namespace
- [X] Return stdout/stderr of the executed command