Documentation ¶
Index ¶
- Variables
- func LeaveRunning(args []string) []string
- func PreDump(args []string) []string
- func ReadPidFile(path string) (int, error)
- type Blkio
- type BlkioEntry
- type CgroupMode
- type CheckpointAction
- type CheckpointOpts
- type ConsoleSocket
- type Container
- type Cpu
- type CpuUsage
- type CreateOpts
- type DeleteOpts
- type Event
- type ExecOpts
- type Exit
- type Format
- type Hugetlb
- type IO
- type KillOpts
- type Memory
- type MemoryEntry
- type Pids
- type ProcessMonitor
- type RestoreOpts
- type Runc
- func (r *Runc) Checkpoint(context context.Context, id string, opts *CheckpointOpts, ...) error
- func (r *Runc) Create(context context.Context, id, bundle string, opts *CreateOpts) error
- func (r *Runc) Delete(context context.Context, id string, opts *DeleteOpts) error
- func (r *Runc) Events(context context.Context, id string, interval time.Duration) (chan *Event, error)
- func (r *Runc) Exec(context context.Context, id string, spec specs.Process, opts *ExecOpts) error
- func (r *Runc) Kill(context context.Context, id string, sig int, opts *KillOpts) error
- func (r *Runc) List(context context.Context) ([]*Container, error)
- func (r *Runc) Pause(context context.Context, id string) error
- func (r *Runc) Ps(context context.Context, id string) ([]int, error)
- func (r *Runc) Restore(context context.Context, id, bundle string, opts *RestoreOpts) (int, error)
- func (r *Runc) Resume(context context.Context, id string) error
- func (r *Runc) Run(context context.Context, id, bundle string, opts *CreateOpts) (int, error)
- func (r *Runc) Start(context context.Context, id string) error
- func (r *Runc) State(context context.Context, id string) (*Container, error)
- func (r *Runc) Stats(context context.Context, id string) (*Stats, error)
- func (r *Runc) Update(context context.Context, id string, resources *specs.LinuxResources) error
- func (r *Runc) Version(context context.Context) (Version, error)
- type Socket
- type StartCloser
- type Stats
- type Throttling
- type Version
Constants ¶
This section is empty.
Variables ¶
var ErrParseRuncVersion = errors.New("unable to parse runc version")
Functions ¶
func LeaveRunning ¶
LeaveRunning keeps the container running after the checkpoint has been completed
func ReadPidFile ¶
ReadPidFile reads the pid file at the provided path and returns the pid or an error if the read and conversion is unsuccessful
Types ¶
type Blkio ¶
type Blkio struct { IoServiceBytesRecursive []BlkioEntry `json:"ioServiceBytesRecursive,omitempty"` IoServicedRecursive []BlkioEntry `json:"ioServicedRecursive,omitempty"` IoQueuedRecursive []BlkioEntry `json:"ioQueueRecursive,omitempty"` IoServiceTimeRecursive []BlkioEntry `json:"ioServiceTimeRecursive,omitempty"` IoWaitTimeRecursive []BlkioEntry `json:"ioWaitTimeRecursive,omitempty"` IoMergedRecursive []BlkioEntry `json:"ioMergedRecursive,omitempty"` IoTimeRecursive []BlkioEntry `json:"ioTimeRecursive,omitempty"` SectorsRecursive []BlkioEntry `json:"sectorsRecursive,omitempty"` }
type BlkioEntry ¶
type CgroupMode ¶
type CgroupMode string
const ( Soft CgroupMode = "soft" Full CgroupMode = "full" Strict CgroupMode = "strict" )
type CheckpointAction ¶
type CheckpointOpts ¶
type CheckpointOpts struct { // ImagePath is the path for saving the criu image file ImagePath string // WorkDir is the working directory for criu WorkDir string // ParentPath is the path for previous image files from a pre-dump ParentPath string // AllowOpenTCP allows open tcp connections to be checkpointed AllowOpenTCP bool // AllowExternalUnixSockets allows external unix sockets to be checkpointed AllowExternalUnixSockets bool // AllowTerminal allows the terminal(pty) to be checkpointed with a container AllowTerminal bool // CriuPageServer is the address:port for the criu page server CriuPageServer string // FileLocks handle file locks held by the container FileLocks bool // Cgroups is the cgroup mode for how to handle the checkpoint of a container's cgroups Cgroups CgroupMode // EmptyNamespaces creates a namespace for the container but does not save its properties // Provide the namespaces you wish to be checkpointed without their settings on restore EmptyNamespaces []string }
type ConsoleSocket ¶
type ConsoleSocket interface {
Path() string
}
type Container ¶
type Container struct { ID string `json:"id"` Pid 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"` }
Container hold information for a runc container
type Cpu ¶
type Cpu struct { Usage CpuUsage `json:"usage,omitempty"` Throttling Throttling `json:"throttling,omitempty"` }
type CreateOpts ¶
type DeleteOpts ¶
type DeleteOpts struct {
Force bool
}
type Event ¶
type Event struct { // Type are the event type generated by runc // If the type is "error" then check the Err field on the event for // the actual error Type string `json:"type"` ID string `json:"id"` Stats *Stats `json:"data,omitempty"` // Err has a read error if we were unable to decode the event from runc Err error `json:"-"` }
type IO ¶
type IO interface { io.Closer Stdin() io.WriteCloser Stdout() io.ReadCloser Stderr() io.ReadCloser Set(*exec.Cmd) }
type KillOpts ¶
type KillOpts struct {
All bool
}
KillOpts specifies options for killing a container and its processes
type Memory ¶
type Memory struct { Cache uint64 `json:"cache,omitempty"` Usage MemoryEntry `json:"usage,omitempty"` Swap MemoryEntry `json:"swap,omitempty"` Kernel MemoryEntry `json:"kernel,omitempty"` KernelTCP MemoryEntry `json:"kernelTCP,omitempty"` Raw map[string]uint64 `json:"raw,omitempty"` }
type MemoryEntry ¶
type ProcessMonitor ¶
type ProcessMonitor interface { Start(*exec.Cmd) (chan Exit, error) Wait(*exec.Cmd, chan Exit) (int, error) }
ProcessMonitor is an interface for process monitoring
It allows daemons using go-runc to have a SIGCHLD handler to handle exits without introducing races between the handler and go's exec.Cmd These methods should match the methods exposed by exec.Cmd to provide a consistent experience for the caller
var Monitor ProcessMonitor = &defaultMonitor{}
type RestoreOpts ¶
type Runc ¶
type Runc struct { //If command is empty, DefaultCommand is used Command string Root string Debug bool Log string LogFormat Format PdeathSignal syscall.Signal Setpgid bool Criu string SystemdCgroup bool }
Runc is the client to the runc cli
func (*Runc) Checkpoint ¶
func (r *Runc) Checkpoint(context context.Context, id string, opts *CheckpointOpts, actions ...CheckpointAction) error
Checkpoint allows you to checkpoint a container using criu
func (*Runc) Create ¶
Create creates a new container and returns its pid if it was created successfully
func (*Runc) Events ¶
func (r *Runc) Events(context context.Context, id string, interval time.Duration) (chan *Event, error)
Events returns an event stream from runc for a container with stats and OOM notifications
func (*Runc) Exec ¶
Exec executres and additional process inside the container based on a full OCI Process specification
func (*Runc) Run ¶
Run runs the create, start, delete lifecycle of the container and returns its exit status after it has exited
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
Socket is a unix socket that accepts the pty master created by runc
func NewConsoleSocket ¶
NewConsoleSocket creates a new unix socket at the provided path to accept a pty master created by runc for use by the container
func NewTempConsoleSocket ¶
NewTempConsoleSocket returns a temp console socket for use with a container On Close(), the socket is deleted
type StartCloser ¶
type StartCloser interface {
CloseAfterStart() error
}