Skip to content

Golang library to manipulate namespaces with nsenter

Notifications You must be signed in to change notification settings

Devatoria/go-nsenter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

go-nsenter

GoDoc

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

About

Golang library to manipulate namespaces with nsenter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages