utils

package
v0.0.0-...-ec96f79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

credit: https://github.com/opencontainers/runc

credit: https://github.com/opencontainers/runc

credit: https://github.com/opencontainers/runc

credit: https://github.com/opencontainers/runc

Index

Constants

View Source
const (
	ACT_CREATE action = iota + 1
	ACT_RUN
)

Variables

View Source
var RlimitMap = map[string]int{
	"RLIMIT_CPU":        unix.RLIMIT_CPU,
	"RLIMIT_FSIZE":      unix.RLIMIT_FSIZE,
	"RLIMIT_DATA":       unix.RLIMIT_DATA,
	"RLIMIT_STACK":      unix.RLIMIT_STACK,
	"RLIMIT_CORE":       unix.RLIMIT_CORE,
	"RLIMIT_RSS":        unix.RLIMIT_RSS,
	"RLIMIT_NPROC":      unix.RLIMIT_NPROC,
	"RLIMIT_NOFILE":     unix.RLIMIT_NOFILE,
	"RLIMIT_MEMLOCK":    unix.RLIMIT_MEMLOCK,
	"RLIMIT_AS":         unix.RLIMIT_AS,
	"RLIMIT_LOCKS":      unix.RLIMIT_LOCKS,
	"RLIMIT_SIGPENDING": unix.RLIMIT_SIGPENDING,
	"RLIMIT_MSGQUEUE":   unix.RLIMIT_MSGQUEUE,
	"RLIMIT_NICE":       unix.RLIMIT_NICE,
	"RLIMIT_RTPRIO":     unix.RLIMIT_RTPRIO,
	"RLIMIT_RTTIME":     unix.RLIMIT_RTTIME,
}

Functions

func Destroy

func Destroy(container libcontainer.Container)

func GetContainer

func GetContainer(root, id string) (libcontainer.Container, error)

func GetSubCgroupPaths

func GetSubCgroupPaths(args []string) (map[string]string, error)

func NewProcess

func NewProcess(p specs.Process) (*libcontainer.Process, error)

func NotifySocketStart

func NotifySocketStart(root, notifySocketPath, id string) (*notifySocket, error)

func ParseSignal

func ParseSignal(sigstr string) (unix.Signal, error)

func ReviseStateDir

func ReviseStateDir(state string) (path string, err error)

func ShouldHonorXDGRuntimeDir

func ShouldHonorXDGRuntimeDir() bool

func ShouldUseRootlessCgroups

func ShouldUseRootlessCgroups(rootless string, systemdCg bool) (bool, error)

Types

type ConstainerState

type ConstainerState struct {
	Version     string            `json:"ociVersion"`
	ID          string            `json:"id"`
	InitPid     int               `json:"pid"`
	Status      string            `json:"status"`
	Bundle      string            `json:"bundle"`
	Rootfs      string            `json:"rootfs"`
	Created     time.Time         `json:"created"`
	Annotations map[string]string `json:"annotations,omitempty"`
	Owner       string            `json:"owner"`
}

func GetContainers

func GetContainers(statePath string) ([]ConstainerState, error)

type FactoryOpts

type FactoryOpts struct {
	UseSystemdCgroup bool
	NoPivotRoot      bool
	NoNewKeyring     bool
	Rootless         string
}

func (*FactoryOpts) CreateContainer

func (f *FactoryOpts) CreateContainer(state string, id string, spec *specs.Spec) (libcontainer.Container, error)

type ProcessOpts

type ProcessOpts struct {
	Process        string
	Cwd            string
	Apparmour      string
	ProcessLabel   string
	Cap            []string
	Env            []string
	Args           []string
	Cgroups        []string
	Tty            bool
	NoNewPrivs     bool
	IgnorePaused   bool
	User           string
	AdditionalGids []int64
}

func (*ProcessOpts) GetProcess

func (pp *ProcessOpts) GetProcess(bundle string) (*specs.Process, error)

type Runner

type Runner struct {
	FactoryOpts
	ProcessOpts
	EnableSubreaper bool
	ShouldDestroy   bool
	PreserveFDS     int
	PidFile         string
	ConsoleSocket   string

	Detach bool
	// contains filtered or unexported fields
}

func (*Runner) Exec

func (r *Runner) Exec(root, id string) (int, error)

func (*Runner) StartContainer

func (r *Runner) StartContainer(bundle, id, state string, act action) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL