Documentation ¶
Overview ¶
Package lxc provides Go Bindings for LXC (Linux Containers) C API.
LXC (LinuX Containers) is an operating system–level virtualization method for running multiple isolated Linux systems (containers) on a single control host.
LXC combines cgroups and namespace support to provide an isolated environment for applications.
Index ¶
- Constants
- Variables
- func Acquire(c *Container) bool
- func ActiveContainerNames(lxcpath ...string) []string
- func ContainerNames(lxcpath ...string) []string
- func DefaultConfigPath() string
- func DefaultLvmVg() string
- func DefaultZfsRoot() string
- func DefinedContainerNames(lxcpath ...string) []string
- func GlobalConfigItem(name string) string
- func HasApiExtension(extension string) bool
- func IsSupportedConfigItem(key string) bool
- func Release(c *Container) bool
- func Version() string
- func VersionAtLeast(major int, minor int, micro int) bool
- func VersionNumber() (major int, minor int)
- type AttachOptions
- type BackendStore
- type BackendStoreSpecs
- type ByteSize
- type CheckpointOptions
- type CloneOptions
- type ConsoleLogOptions
- type ConsoleOptions
- type Container
- func (c *Container) AddDeviceNode(source string, destination ...string) error
- func (c *Container) AttachInterface(source, destination string) error
- func (c *Container) AttachShell(options AttachOptions) error
- func (c *Container) BlkioUsage() (ByteSize, error)
- func (c *Container) CPUStats() (map[string]int64, error)
- func (c *Container) CPUTime() (time.Duration, error)
- func (c *Container) CPUTimePerCPU() (map[int]time.Duration, error)
- func (c *Container) CgroupItem(key string) []string
- func (c *Container) Checkpoint(opts CheckpointOptions) error
- func (c *Container) ClearConfig()
- func (c *Container) ClearConfigItem(key string) error
- func (c *Container) Clone(name string, options CloneOptions) error
- func (c *Container) ConfigFileName() string
- func (c *Container) ConfigItem(key string) []string
- func (c *Container) ConfigKeys(key ...string) []string
- func (c *Container) ConfigPath() string
- func (c *Container) Console(options ConsoleOptions) error
- func (c *Container) ConsoleFd(ttynum int) (int, error)
- func (c *Container) ConsoleLog(opt ConsoleLogOptions) ([]byte, error)
- func (c *Container) Controllable() bool
- func (c *Container) Create(options TemplateOptions) error
- func (c *Container) CreateSnapshot() (*Snapshot, error)
- func (c *Container) Daemonize() bool
- func (c *Container) Defined() bool
- func (c *Container) Destroy() error
- func (c *Container) DestroyAllSnapshots() error
- func (c *Container) DestroySnapshot(snapshot Snapshot) error
- func (c *Container) DestroyWithAllSnapshots() error
- func (c *Container) DetachInterface(source string) error
- func (c *Container) DetachInterfaceRename(source, target string) error
- func (c *Container) DevptsFd() (*os.File, error)
- func (c *Container) ErrorNum() int
- func (c *Container) Execute(args ...string) ([]byte, error)
- func (c *Container) Freeze() error
- func (c *Container) IPAddress(interfaceName string) ([]string, error)
- func (c *Container) IPAddresses() ([]string, error)
- func (c *Container) IPv4Address(interfaceName string) ([]string, error)
- func (c *Container) IPv4Addresses() ([]string, error)
- func (c *Container) IPv6Address(interfaceName string) ([]string, error)
- func (c *Container) IPv6Addresses() ([]string, error)
- func (c *Container) InitPid() int
- func (c *Container) InitPidFd() (*os.File, error)
- func (c *Container) InterfaceStats() (map[string]map[string]ByteSize, error)
- func (c *Container) Interfaces() ([]string, error)
- func (c *Container) KernelMemoryLimit() (ByteSize, error)
- func (c *Container) KernelMemoryUsage() (ByteSize, error)
- func (c *Container) LoadConfigFile(path string) error
- func (c *Container) LogFile() string
- func (c *Container) LogLevel() LogLevel
- func (c *Container) MemoryLimit() (ByteSize, error)
- func (c *Container) MemorySwapLimit() (ByteSize, error)
- func (c *Container) MemorySwapUsage() (ByteSize, error)
- func (c *Container) MemoryUsage() (ByteSize, error)
- func (c *Container) Migrate(cmd uint, opts MigrateOptions) error
- func (c *Container) Name() string
- func (c *Container) Reboot() error
- func (c *Container) Release() error
- func (c *Container) RemoveDeviceNode(source string, destination ...string) error
- func (c *Container) Rename(name string) error
- func (c *Container) Restore(opts RestoreOptions) error
- func (c *Container) RestoreSnapshot(snapshot Snapshot, name string) error
- func (c *Container) RunCommand(args []string, options AttachOptions) (bool, error)
- func (c *Container) RunCommandNoWait(args []string, options AttachOptions) (int, error)
- func (c *Container) RunCommandStatus(args []string, options AttachOptions) (int, error)
- func (c *Container) Running() bool
- func (c *Container) RunningConfigItem(key string) []string
- func (c *Container) SaveConfigFile(path string) error
- func (c *Container) SeccompNotifyFd() (*os.File, error)
- func (c *Container) SeccompNotifyFdActive() (*os.File, error)
- func (c *Container) SetCgroupItem(key string, value string) error
- func (c *Container) SetConfigItem(key string, value string) error
- func (c *Container) SetConfigPath(path string) error
- func (c *Container) SetKernelMemoryLimit(limit ByteSize) error
- func (c *Container) SetLogFile(filename string) error
- func (c *Container) SetLogLevel(level LogLevel) error
- func (c *Container) SetMemoryLimit(limit ByteSize) error
- func (c *Container) SetMemorySwapLimit(limit ByteSize) error
- func (c *Container) SetSoftMemoryLimit(limit ByteSize) error
- func (c *Container) SetVerbosity(verbosity Verbosity)
- func (c *Container) Shutdown(timeout time.Duration) error
- func (c *Container) Snapshots() ([]Snapshot, error)
- func (c *Container) SoftMemoryLimit() (ByteSize, error)
- func (c *Container) Start() error
- func (c *Container) StartExecute(args []string) error
- func (c *Container) StartWithArgs(args []string) error
- func (c *Container) State() State
- func (c *Container) Stop() error
- func (c *Container) String() string
- func (c *Container) Unfreeze() error
- func (c *Container) Wait(state State, timeout time.Duration) bool
- func (c *Container) WaitIPAddresses(timeout time.Duration) ([]string, error)
- func (c *Container) WantCloseAllFds(state bool) error
- func (c *Container) WantDaemonize(state bool) error
- type CriuFeatures
- type LogLevel
- type MigrateOptions
- type Personality
- type RestoreOptions
- type Snapshot
- type State
- type TemplateOptions
- type Verbosity
Constants ¶
const ( ErrAddDeviceNodeFailed = lxcError("adding device to container failed") ErrAllocationFailed = lxcError("allocating memory failed") ErrAlreadyDefined = lxcError("container already defined") ErrAlreadyFrozen = lxcError("container is already frozen") ErrAlreadyRunning = lxcError("container is already running") ErrAttachFailed = lxcError("attaching to the container failed") ErrAttachInterfaceFailed = lxcError("attaching specified netdev to the container failed") ErrBlkioUsage = lxcError("BlkioUsage for the container failed") ErrCheckpointFailed = lxcError("checkpoint failed") ErrClearingConfigItemFailed = lxcError("clearing config item for the container failed") ErrClearingCgroupItemFailed = lxcError("clearing cgroup item for the container failed") ErrCloneFailed = lxcError("cloning the container failed") ErrCloseAllFdsFailed = lxcError("setting close_all_fds flag for container failed") ErrCreateFailed = lxcError("creating the container failed") ErrCreateSnapshotFailed = lxcError("snapshotting the container failed") ErrDaemonizeFailed = lxcError("setting daemonize flag for container failed") ErrDestroyAllSnapshotsFailed = lxcError("destroying all snapshots failed") ErrDestroyFailed = lxcError("destroying the container failed") ErrDestroySnapshotFailed = lxcError("destroying the snapshot failed") ErrDestroyWithAllSnapshotsFailed = lxcError("destroying the container with all snapshots failed") ErrDetachInterfaceFailed = lxcError("detaching specified netdev to the container failed") ErrExecuteFailed = lxcError("executing the command in a temporary container failed") ErrFreezeFailed = lxcError("freezing the container failed") ErrInsufficientNumberOfArguments = lxcError("insufficient number of arguments were supplied") ErrInterfaces = lxcError("getting interface names for the container failed") ErrIPAddresses = lxcError("getting IP addresses of the container failed") ErrIPAddress = lxcError("getting IP address on the interface of the container failed") ErrIPv4Addresses = lxcError("getting IPv4 addresses of the container failed") ErrIPv6Addresses = lxcError("getting IPv6 addresses of the container failed") ErrKMemLimit = lxcError("your kernel does not support cgroup kernel memory controller") ErrLoadConfigFailed = lxcError("loading config file for the container failed") ErrMemLimit = lxcError("your kernel does not support cgroup memory controller") ErrMemorySwapLimit = lxcError("your kernel does not support cgroup swap controller") ErrMethodNotAllowed = lxcError("the requested method is not currently supported with unprivileged containers") ErrNewFailed = lxcError("allocating the container failed") ErrNoSnapshot = lxcError("container has no snapshot") ErrNotDefined = lxcError("container is not defined") ErrNotFrozen = lxcError("container is not frozen") ErrNotRunning = lxcError("container is not running") ErrNotSupported = lxcError("method is not supported by this LXC version") ErrRebootFailed = lxcError("rebooting the container failed") ErrRemoveDeviceNodeFailed = lxcError("removing device from container failed") ErrRenameFailed = lxcError("renaming the container failed") ErrRestoreFailed = lxcError("restore failed") ErrRestoreSnapshotFailed = lxcError("restoring the container failed") ErrSaveConfigFailed = lxcError("saving config file for the container failed") ErrSettingCgroupItemFailed = lxcError("setting cgroup item for the container failed") ErrSettingConfigItemFailed = lxcError("setting config item for the container failed") ErrSettingConfigPathFailed = lxcError("setting config file for the container failed") ErrSettingKMemoryLimitFailed = lxcError("setting kernel memory limit for the container failed") ErrSettingMemoryLimitFailed = lxcError("setting memory limit for the container failed") ErrSettingMemorySwapLimitFailed = lxcError("setting memory+swap limit for the container failed") ErrSettingSoftMemoryLimitFailed = lxcError("setting soft memory limit for the container failed") ErrShutdownFailed = lxcError("shutting down the container failed") ErrSoftMemLimit = lxcError("your kernel does not support cgroup memory controller") ErrStartFailed = lxcError("starting the container failed") ErrStopFailed = lxcError("stopping the container failed") ErrTemplateNotAllowed = lxcError("unprivileged users only allowed to use \"download\" template") ErrUnfreezeFailed = lxcError("unfreezing the container failed") ErrUnknownBackendStore = lxcError("unknown backend type") ErrReleaseFailed = lxcError("releasing the container failed") )
const ( MIGRATE_PRE_DUMP = 0 MIGRATE_DUMP = 1 MIGRATE_RESTORE = 2 MIGRATE_FEATURE_CHECK = 3 )
Variables ¶
var BusyboxTemplateOptions = TemplateOptions{
Template: "busybox",
}
BusyboxTemplateOptions is a convenient set of options for "busybox" template.
var DefaultAttachOptions = AttachOptions{ Namespaces: -1, Arch: -1, Cwd: "/", UID: -1, GID: -1, Groups: nil, ClearEnv: false, Env: nil, EnvToKeep: nil, StdinFd: os.Stdin.Fd(), StdoutFd: os.Stdout.Fd(), StderrFd: os.Stderr.Fd(), }
DefaultAttachOptions is a convenient set of options to be used.
var DefaultCloneOptions = CloneOptions{ Backend: Directory, }
DefaultCloneOptions is a convenient set of options to be used.
var DefaultConsoleOptions = ConsoleOptions{ Tty: -1, StdinFd: os.Stdin.Fd(), StdoutFd: os.Stdout.Fd(), StderrFd: os.Stderr.Fd(), EscapeCharacter: 'a', }
DefaultConsoleOptions is a convenient set of options to be used.
var DownloadTemplateOptions = TemplateOptions{
Template: "download",
Distro: "ubuntu",
Release: "trusty",
Arch: "amd64",
}
DownloadTemplateOptions is a convenient set of options for "download" template.
var StateMap = map[string]State{ "STOPPED": STOPPED, "STARTING": STARTING, "RUNNING": RUNNING, "STOPPING": STOPPING, "ABORTING": ABORTING, "FREEZING": FREEZING, "FROZEN": FROZEN, "THAWED": THAWED, }
StateMap provides the mapping betweens the state names and states
var UbuntuTemplateOptions = TemplateOptions{
Template: "ubuntu",
}
UbuntuTemplateOptions is a convenient set of options for "ubuntu" template.
Functions ¶
func ActiveContainerNames ¶
ActiveContainerNames returns the names of the active containers on the system.
func ContainerNames ¶
ContainerNames returns the names of defined and active containers on the system.
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns default config path.
func DefaultLvmVg ¶
func DefaultLvmVg() string
DefaultLvmVg returns the name of the default LVM volume group.
func DefaultZfsRoot ¶
func DefaultZfsRoot() string
DefaultZfsRoot returns the name of the default ZFS root.
func DefinedContainerNames ¶
DefinedContainerNames returns the names of the defined containers on the system.
func GlobalConfigItem ¶
GlobalConfigItem returns the value of the given global config key.
func HasApiExtension ¶
HasApiExtension returns true if the extension is supported.
func IsSupportedConfigItem ¶
IsSupportedConfigItem returns true if the key belongs to a supported config item.
func VersionAtLeast ¶
VersionAtLeast returns true when the tested version >= current version.
func VersionNumber ¶
VersionNumber returns the LXC version.
Types ¶
type AttachOptions ¶
type AttachOptions struct { // Specify the namespaces to attach to, as OR'ed list of clone flags (syscall.CLONE_NEWNS | syscall.CLONE_NEWUTS ...). Namespaces int // Specify the architecture which the kernel should appear to be running as to the command executed. Arch Personality // Cwd specifies the working directory of the command. Cwd string // UID specifies the user id to run as. UID int // GID specifies the group id to run as. GID int // Groups specifies the list of additional group ids to run with. Groups []int // If ClearEnv is true the environment is cleared before running the command. ClearEnv bool // Env specifies the environment of the process. Env []string // EnvToKeep specifies the environment of the process when ClearEnv is true. EnvToKeep []string // StdinFd specifies the fd to read input from. StdinFd uintptr // StdoutFd specifies the fd to write output to. StdoutFd uintptr // StderrFd specifies the fd to write error output to. StderrFd uintptr }
AttachOptions type is used for defining various attach options.
type BackendStore ¶
type BackendStore int
BackendStore type specifies possible backend types.
const ( // Btrfs backendstore type Btrfs BackendStore = iota + 1 // Directory backendstore type Directory // LVM backendstore type LVM // ZFS backendstore type ZFS // Aufs backendstore type Aufs // Overlayfs backendstore type Overlayfs // Loopback backendstore type Loopback // Best backendstore type Best )
func (*BackendStore) Set ¶
func (t *BackendStore) Set(value string) error
Set is the method to set the flag value, part of the flag.Value interface.
type BackendStoreSpecs ¶
type ByteSize ¶
type ByteSize float64
ByteSize type
func ParseBytes ¶
ParseBytes parses a byte size string. A byte size string is a number followed by a unit suffix, such as "1024B" or "1 MB". Valid byte units are "B", "KB", "MB", "GB", "TB", "PB" and "EB". You can also use the long format of units, such as "kilobyte" or "kilobytes".
type CheckpointOptions ¶
CheckpointOptions type is used for defining checkpoint options for CRIU.
type CloneOptions ¶
type CloneOptions struct { // Backend specifies the type of the backend. Backend BackendStore // lxcpath in which to create the new container. If not set the original container's lxcpath will be used. ConfigPath string // Do not change the hostname of the container (in the root filesystem). KeepName bool // Use the same MAC address as the original container, rather than generating a new random one. KeepMAC bool // Create a snapshot rather than copy. Snapshot bool }
CloneOptions type is used for defining various clone options.
type ConsoleLogOptions ¶
ConsoleLogOptions type is used for defining console log options.
type ConsoleOptions ¶
type ConsoleOptions struct { // Tty number to attempt to allocate, -1 to allocate the first available tty, or 0 to allocate the console. Tty int // StdinFd specifies the fd to read input from. StdinFd uintptr // StdoutFd specifies the fd to write output to. StdoutFd uintptr // StderrFd specifies the fd to write error output to. StderrFd uintptr // EscapeCharacter (a means <Ctrl a>, b maens <Ctrl b>). EscapeCharacter rune }
ConsoleOptions type is used for defining various console options.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container struct
func ActiveContainers ¶
ActiveContainers returns the active containers on the system. Only containers that could retrieved successfully are returned. Caller needs to call Release() on the returned containers to release resources.
func Containers ¶
Containers returns the defined and active containers on the system. Only containers that could retrieved successfully are returned. Caller needs to call Release() on the returned containers to release resources.
func DefinedContainers ¶
DefinedContainers returns the defined containers on the system. Only containers that could retrieved successfully are returned. Caller needs to call Release() on the returned containers to release resources.
func NewContainer ¶
NewContainer returns a new container struct. Caller needs to call Release() on the returned container to release its resources.
func (*Container) AddDeviceNode ¶
AddDeviceNode adds specified device to the container.
func (*Container) AttachInterface ¶
AttachInterface attaches specified netdev to the container.
func (*Container) AttachShell ¶
func (c *Container) AttachShell(options AttachOptions) error
AttachShell attaches a shell to the container. It clears all environment variables before attaching.
func (*Container) BlkioUsage ¶
BlkioUsage returns number of bytes transferred to/from the disk by the container.
func (*Container) CPUStats ¶
CPUStats returns the number of CPU cycles (in the units defined by USER_HZ on the system) consumed by tasks in this cgroup and its children in both user mode and system (kernel) mode.
func (*Container) CPUTime ¶
CPUTime returns the total CPU time (in nanoseconds) consumed by all tasks in this cgroup (including tasks lower in the hierarchy).
func (*Container) CPUTimePerCPU ¶
CPUTimePerCPU returns the CPU time (in nanoseconds) consumed on each CPU by all tasks in this cgroup (including tasks lower in the hierarchy).
func (*Container) CgroupItem ¶
CgroupItem returns the value of the given cgroup subsystem value.
func (*Container) Checkpoint ¶
func (c *Container) Checkpoint(opts CheckpointOptions) error
Checkpoint checkpoints the container.
func (*Container) ClearConfig ¶
func (c *Container) ClearConfig()
ClearConfig completely clears the containers in-memory configuration.
func (*Container) ClearConfigItem ¶
ClearConfigItem clears the value of given config item.
func (*Container) Clone ¶
func (c *Container) Clone(name string, options CloneOptions) error
Clone clones the container using given arguments with specified backend.
func (*Container) ConfigFileName ¶
ConfigFileName returns the container's configuration file's name.
func (*Container) ConfigItem ¶
ConfigItem returns the value of the given config item.
func (*Container) ConfigKeys ¶
ConfigKeys returns the names of the config items.
func (*Container) ConfigPath ¶
ConfigPath returns the configuration file's path.
func (*Container) Console ¶
func (c *Container) Console(options ConsoleOptions) error
Console allocates and runs a console tty from container
This function will not return until the console has been exited by the user.
func (*Container) ConsoleFd ¶
ConsoleFd allocates a console tty from container ttynum: tty number to attempt to allocate or -1 to allocate the first available tty
Returns "ttyfd" on success, -1 on failure. The returned "ttyfd" is used to keep the tty allocated. The caller should close "ttyfd" to indicate that it is done with the allocated console so that it can be allocated by another caller.
func (*Container) ConsoleLog ¶
func (c *Container) ConsoleLog(opt ConsoleLogOptions) ([]byte, error)
ConsoleLog allows to perform operations on the container's in-memory console buffer.
func (*Container) Controllable ¶
Controllable returns true if the caller can control the container.
func (*Container) Create ¶
func (c *Container) Create(options TemplateOptions) error
Create creates the container using given TemplateOptions
func (*Container) CreateSnapshot ¶
CreateSnapshot creates a new snapshot.
func (*Container) DestroyAllSnapshots ¶
DestroyAllSnapshots destroys all the snapshot.
func (*Container) DestroySnapshot ¶
DestroySnapshot destroys the specified snapshot.
func (*Container) DestroyWithAllSnapshots ¶
DestroyWithAllSnapshots destroys the container and its snapshots
func (*Container) DetachInterface ¶
DetachInterface detaches specified netdev from the container.
func (*Container) DetachInterfaceRename ¶
DetachInterfaceRename detaches specified netdev from the container and renames it.
func (*Container) IPAddresses ¶
IPAddresses returns all IP addresses.
func (*Container) IPv4Address ¶
IPv4Address returns the IPv4 address of the given network interface.
func (*Container) IPv4Addresses ¶
IPv4Addresses returns all IPv4 addresses.
func (*Container) IPv6Address ¶
IPv6Address returns the IPv6 address of the given network interface.
func (*Container) IPv6Addresses ¶
IPv6Addresses returns all IPv6 addresses.
func (*Container) InitPid ¶
InitPid returns the process ID of the container's init process seen from outside the container.
func (*Container) InterfaceStats ¶
InterfaceStats returns the stats about container's network interfaces
func (*Container) Interfaces ¶
Interfaces returns the names of the network interfaces.
func (*Container) KernelMemoryLimit ¶
KernelMemoryLimit returns kernel memory limit of the container in bytes.
func (*Container) KernelMemoryUsage ¶
KernelMemoryUsage returns current kernel memory allocation of the container in bytes.
func (*Container) LoadConfigFile ¶
LoadConfigFile loads the configuration file from given path.
func (*Container) MemoryLimit ¶
MemoryLimit returns memory limit of the container in bytes.
func (*Container) MemorySwapLimit ¶
MemorySwapLimit returns the memory+swap limit of the container in bytes.
func (*Container) MemorySwapUsage ¶
MemorySwapUsage returns memory+swap usage of the container in bytes.
func (*Container) MemoryUsage ¶
MemoryUsage returns memory usage of the container in bytes.
func (*Container) Migrate ¶
func (c *Container) Migrate(cmd uint, opts MigrateOptions) error
Migrate migrates the container.
func (*Container) Release ¶
Release decrements the reference counter of the container object. nil on success or if reference was successfully dropped and container has been freed, and ErrReleaseFailed on error.
func (*Container) RemoveDeviceNode ¶
RemoveDeviceNode removes the specified device from the container.
func (*Container) Restore ¶
func (c *Container) Restore(opts RestoreOptions) error
Restore restores the container from a checkpoint.
func (*Container) RestoreSnapshot ¶
RestoreSnapshot creates a new container based on a snapshot.
func (*Container) RunCommand ¶
func (c *Container) RunCommand(args []string, options AttachOptions) (bool, error)
RunCommand attachs a shell and runs the command within the container. The process will wait for the command to finish and return a success status. An error is returned only when invocation of the command completely fails.
func (*Container) RunCommandNoWait ¶
func (c *Container) RunCommandNoWait(args []string, options AttachOptions) (int, error)
RunCommandNoWait runs the given command and returns without waiting it to finish.
func (*Container) RunCommandStatus ¶
func (c *Container) RunCommandStatus(args []string, options AttachOptions) (int, error)
RunCommandStatus attachs a shell and runs the command within the container. The process will wait for the command to finish and return the result of waitpid(), i.e. the process' exit status. An error is returned only when invocation of the command completely fails.
func (*Container) RunningConfigItem ¶
RunningConfigItem returns the value of the given config item.
func (*Container) SaveConfigFile ¶
SaveConfigFile saves the configuration file to given path.
func (*Container) SeccompNotifyFd ¶
SeccompNotifyFd returns the seccomp notify fd of the container.
func (*Container) SeccompNotifyFdActive ¶
SeccompNotifyFdActive returns the seccomp notify fd of the running container.
func (*Container) SetCgroupItem ¶
SetCgroupItem sets the value of given cgroup subsystem value.
func (*Container) SetConfigItem ¶
SetConfigItem sets the value of the given config item.
func (*Container) SetConfigPath ¶
SetConfigPath sets the configuration file's path.
func (*Container) SetKernelMemoryLimit ¶
SetKernelMemoryLimit sets kernel memory limit of the container in bytes.
func (*Container) SetLogFile ¶
SetLogFile sets the name of the logfile.
func (*Container) SetLogLevel ¶
SetLogLevel sets the level of the logfile.
func (*Container) SetMemoryLimit ¶
SetMemoryLimit sets memory limit of the container in bytes.
func (*Container) SetMemorySwapLimit ¶
SetMemorySwapLimit sets memory+swap limit of the container in bytes.
func (*Container) SetSoftMemoryLimit ¶
SetSoftMemoryLimit sets soft memory limit of the container in bytes.
func (*Container) SetVerbosity ¶
SetVerbosity sets the verbosity level of some API calls
func (*Container) SoftMemoryLimit ¶
SoftMemoryLimit returns soft memory limit of the container in bytes.
func (*Container) StartExecute ¶
StartExecute starts a container. It runs a minimal init as PID 1 and the requested program as the second process.
func (*Container) StartWithArgs ¶
StartWithArgs starts the container using given arguments.
func (*Container) WaitIPAddresses ¶
WaitIPAddresses waits until IPAddresses call returns something or time outs
func (*Container) WantCloseAllFds ¶
WantCloseAllFds determines whether container wishes all file descriptors to be closed on startup.
func (*Container) WantDaemonize ¶
WantDaemonize determines if the container wants to run daemonized.
type CriuFeatures ¶
type CriuFeatures uint64
const ( FEATURE_MEM_TRACK CriuFeatures = 1 << iota FEATURE_LAZY_PAGES )
type MigrateOptions ¶
type MigrateOptions struct { Directory string PredumpDir string ActionScript string Verbose bool Stop bool PreservesInodes bool GhostLimit uint64 FeaturesToCheck CriuFeatures }
MigrateOptions type is used for defining migrate options.
type Personality ¶
type Personality int64
Personality allows to set the architecture for the container.
const ( X86 Personality = 0x0008 X86_64 = 0x0000 )
type RestoreOptions ¶
RestoreOptions type is used for defining restore options for CRIU.
type State ¶
type State int
State type specifies possible container states.
const ( // STOPPED means container is not running STOPPED State = iota + 1 // STARTING means container is starting STARTING // RUNNING means container is running RUNNING // STOPPING means container is stopping STOPPING // ABORTING means container is aborting ABORTING // FREEZING means container is freezing FREEZING // FROZEN means containe is frozen FROZEN // THAWED means container is thawed THAWED )
type TemplateOptions ¶
type TemplateOptions struct { // Template specifies the name of the template. Template string // Backend specifies the type of the backend. Backend BackendStore BackendSpecs *BackendStoreSpecs // Distro specifies the name of the distribution. Distro string // Release specifies the name/version of the distribution. Release string // Arch specified the architecture of the container. Arch string // Variant specifies the variant of the image (default: "default"). Variant string // Image server (default: "images.linuxcontainers.org"). Server string // GPG keyid (default: 0x...). KeyID string // GPG keyserver to use. KeyServer string // Disable GPG validation (not recommended). DisableGPGValidation bool // Flush the local copy (if present). FlushCache bool // Force the use of the local copy even if expired. ForceCache bool // ExtraArgs provides a way to specify template specific args. ExtraArgs []string }
TemplateOptions type is used for defining various template options.