godocker

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2013 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

godocker - Go package to interact with Linux Containers (LXC) through docker

(https://github.com/dotcloud/docker).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerHome

func ContainerHome(c Container) string

FIXME glxc tests compliant but "what the fuck" regarding c.containerHome() ?

func IsExisting

func IsExisting(name string) bool

IsExisting checks if the image exists.

Types

type Container

type Container interface {

	// Name returns the name of the container.
	Name() string

	// After creation, change Name() to docker container id
	SetId(id string)

	// Create creates a new container based on the given template.
	Create(configFile, template string, templateArgs ...string) error

	// Start runs the container as a daemon.
	Start(configFile, consoleFile string) error

	// Stop terminates the running container.
	Stop() error

	// Clone creates a copy of the container, giving the copy the specified name.
	Clone(name string) (Container, error)

	// Freeze freezes all the container's processes.
	Freeze() error

	// Unfreeze thaws all frozen container's processes.
	Unfreeze() error

	// Destroy stops and removes the container.
	Destroy() error

	// Wait waits for one of the specified container states.
	Wait(states ...State) error

	// Info returns the status and the process id of the container.
	Info() (State, int, error)

	// IsConstructed checks if the container image exists.
	IsConstructed() bool

	// IsRunning checks if the state of the container is 'RUNNING'.
	IsRunning() bool

	// String returns information about the container, like the name, state,
	// and process id.
	String() string

	// LogFile returns the current filename used for the LogFile.
	LogFile() string

	// LogLevel returns the current logging level (only used if the
	// LogFile is not "").
	LogLevel() LogLevel

	// SetLogFile sets both the LogFile and LogLevel.
	SetLogFile(filename string, level LogLevel)

	// Get container informations
	GetKeyInfo(key string) (interface{}, error)
	// contains filtered or unexported methods
}

Container represents a linux container instance and provides operations to create, maintain and destroy the container.

type ContainerFactory

type ContainerFactory interface {
	// New returns a container instance which can then be used for operations
	// like Create(), Start(), Stop() or Destroy().
	New(string) Container

	// List returns all the existing containers on the system.
	List() ([]Container, error)
}

ContainerFactory represents the methods used to create Containers.

func Factory

func Factory() ContainerFactory

Factory provides the standard ContainerFactory.

type Error

type Error struct {
	Name   string
	Err    error
	Output []string
}

Error reports the failure of a LXC command.

func (Error) Error

func (e Error) Error() string

type LogLevel

type LogLevel string

LogLevel represents a container's log level.

const (
	LogDebug    LogLevel = "DEBUG"
	LogInfo     LogLevel = "INFO"
	LogNotice   LogLevel = "NOTICE"
	LogWarning  LogLevel = "WARN"
	LogError    LogLevel = "ERROR"
	LogCritical LogLevel = "CRIT"
	LogFatal    LogLevel = "FATAL"
)

type State

type State string

State represents a container state.

const (
	StateUnknown  State = "UNKNOWN"
	StateStopped  State = "STOPPED"
	StateStarting State = "STARTING"
	StateRunning  State = "RUNNING"
	StateAborting State = "ABORTING"
	StateStopping State = "STOPPING"
)

Jump to

Keyboard shortcuts

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