ctr

package
v0.0.0-...-7280f38 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuncInitArg = "runcinit"
)

Variables

View Source
var (
	AllCaps = oci.LinuxCapabilities{
		Bounding:    capList,
		Effective:   capList,
		Permitted:   capList,
		Inheritable: capList,
		Ambient:     capList,
	}
)

Functions

func AttachSelfConsole

func AttachSelfConsole(ctx context.Context, attacher Attachable) error

func HasAnyBind

func HasAnyBind(mountOptions []string) bool

func HasBind

func HasBind(mountOptions []string) bool

func HasRBind

func HasRBind(mountOptions []string) bool

func HasReadOnly

func HasReadOnly(mountOptions []string) bool

func ReplaceOption

func ReplaceOption(options []string, oldOpt string, newOpt string) []string

func SetupSelfConsole

func SetupSelfConsole(ctx context.Context) (<-chan console.WinSize, func(), error)

Types

type Attachable

type Attachable interface {
	Attach(ctx context.Context, in io.Reader, out io.Writer) error
	Resize(console.WinSize)
}

type BindMount

type BindMount struct {
	Source    string
	Dest      string
	Recursive bool
	Readonly  bool
	GenericMountOptions
}

func (BindMount) AddToMountTree

func (m BindMount) AddToMountTree(t *MountTree) error

type CleanupStack

type CleanupStack []func() error

func (CleanupStack) Cleanup

func (cleanups CleanupStack) Cleanup() error

func (CleanupStack) Push

func (cleanups CleanupStack) Push(f func() error) CleanupStack

type Container

type Container interface {
	Attachable
	Wait(context.Context) WaitResult
	Destroy(time.Duration) error
}

type ContainerDef

type ContainerDef struct {
	ContainerProc
	MountBackend
	Hostname       string
	Mounts         Mounts
	UpperDir       string
	WorkDir        string
	Persist        bool
	ReadOnlyRootfs bool
}

type ContainerExistsError

type ContainerExistsError struct {
	ID string
}

func (ContainerExistsError) Error

func (e ContainerExistsError) Error() string

type ContainerProc

type ContainerProc struct {
	Args         []string
	Env          []string
	WorkingDir   string
	Uid          uint32
	Gid          uint32
	Capabilities *oci.LinuxCapabilities
}

type ContainerState

type ContainerState string

func (ContainerState) ContainerExists

func (d ContainerState) ContainerExists() bool

TODO use some locking approach (maybe an O_EXCL file?) to make it possible to check this and then Start() "atomically"

func (ContainerState) ContainerID

func (d ContainerState) ContainerID() string

func (ContainerState) IODir

func (d ContainerState) IODir() IODir

func (ContainerState) InnerDir

func (d ContainerState) InnerDir() string

func (ContainerState) OverlayDir

func (d ContainerState) OverlayDir() OverlayDir

func (ContainerState) RuncStateDir

func (d ContainerState) RuncStateDir() string

func (ContainerState) Start

func (d ContainerState) Start(def ContainerDef) (Container, error)

func (ContainerState) SubOverlayDir

func (d ContainerState) SubOverlayDir(ctrPath string) OverlayDir

type ContainerStateRoot

type ContainerStateRoot string

func (ContainerStateRoot) ContainerState

func (d ContainerStateRoot) ContainerState(containerID string) ContainerState

type DevptsMount

type DevptsMount struct {
	Dest     string
	Ptmxmode os.FileMode
	Mode     os.FileMode
	Uid      uint32
	Gid      uint32
}

func (DevptsMount) AddToMountTree

func (m DevptsMount) AddToMountTree(t *MountTree) error

type FuseOverlayfsBackend

type FuseOverlayfsBackend struct {
	FuseOverlayfsBin string
}

func (FuseOverlayfsBackend) SetupTree

func (b FuseOverlayfsBackend) SetupTree(mt *MountTree, cs ContainerState, upperdir, workdir string) (_ []oci.Mount, cleanup CleanupStack, rerr error)

type GenericMountOptions

type GenericMountOptions struct {
	Noexec      bool
	Nosuid      bool
	Nodev       bool
	Strictatime bool
}

func ParseGenericMountOpts

func ParseGenericMountOpts(options []string) GenericMountOptions

func (GenericMountOptions) Opts

func (o GenericMountOptions) Opts() []string

type IODir

type IODir string

func (IODir) TTYInFifo

func (d IODir) TTYInFifo() string

func (IODir) TTYOutFifo

func (d IODir) TTYOutFifo() string

type InvalidMergedMountErr

type InvalidMergedMountErr struct{}

func (InvalidMergedMountErr) Error

func (e InvalidMergedMountErr) Error() string

type Layer

type Layer struct {
	Src  string
	Dest string
}

func (Layer) AddToMountTree

func (l Layer) AddToMountTree(t *MountTree) error

type MountBackend

type MountBackend interface {
	// TODO make MountTree fields accessible outside this pkg so external impls
	// of MountBackend can be written
	SetupTree(mt *MountTree, cs ContainerState, upperdir, workdir string) ([]oci.Mount, CleanupStack, error)
}

type MountTree

type MountTree struct {
	// contains filtered or unexported fields
}

type MountTreeOpt

type MountTreeOpt interface {
	AddToMountTree(*MountTree) error
}

type Mounts

type Mounts []MountTreeOpt

func DefaultMounts

func DefaultMounts() Mounts

func (Mounts) OCIMounts

func (mounts Mounts) OCIMounts(state ContainerState, upperdir, workdir string, backend MountBackend) ([]oci.Mount, CleanupStack, error)

func (Mounts) With

func (mounts Mounts) With(more ...MountTreeOpt) Mounts

type MqueueMount

type MqueueMount struct{}

func (MqueueMount) AddToMountTree

func (m MqueueMount) AddToMountTree(t *MountTree) error

type NoOverlayfsBackend

type NoOverlayfsBackend struct{}

NoOverlayfsBackend throws an error if an overlay is required to turn the mount tree into a list of OCI mounts.

func (NoOverlayfsBackend) SetupTree

func (b NoOverlayfsBackend) SetupTree(mt *MountTree, cs ContainerState, upperdir, workdir string) (_ []oci.Mount, cleanup CleanupStack, rerr error)

type OCIMount

type OCIMount oci.Mount

func (OCIMount) AddToMountTree

func (m OCIMount) AddToMountTree(t *MountTree) error

type OverlayDir

type OverlayDir string

func (OverlayDir) MountDir

func (d OverlayDir) MountDir() string

func (OverlayDir) PrivateDir

func (d OverlayDir) PrivateDir() string

func (OverlayDir) UpperDir

func (d OverlayDir) UpperDir() string

func (OverlayDir) WorkDir

func (d OverlayDir) WorkDir() string

type ProcfsMount

type ProcfsMount struct{}

func (ProcfsMount) AddToMountTree

func (m ProcfsMount) AddToMountTree(t *MountTree) error

type TmpfsMount

type TmpfsMount struct {
	Dest     string
	ByteSize uint
	Mode     os.FileMode
	GenericMountOptions
}

func (TmpfsMount) AddToMountTree

func (m TmpfsMount) AddToMountTree(t *MountTree) error

type WaitResult

type WaitResult struct {
	State *os.ProcessState
	Err   error
}

Jump to

Keyboard shortcuts

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