docker

package
v0.0.0-...-f4dfc87 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DOCKER_STOP_TIMEOUT = 10 // seconds

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func (*Cache) GetContainer

func (cache *Cache) GetContainer(id ID) (*Container, error)

* Get full container state.

func (*Cache) GetStatus

func (cache *Cache) GetStatus(id ID) (*ContainerStatus, error)

* Return docker container status, or nil if not exists. * * Cached for all containers using list if eager.

type Config

type Config struct {
	Image   string         `json:"image"`
	Command string         `json:"command"`
	Args    []string       `json:"args"`
	Env     util.StringSet `json:"env"`

	Privileged  bool           `json:"privileged"`
	Mounts      []docker.Mount `json:"mounts"`
	NetworkMode string         `json:"net_container"`

	Constraints util.StringSet
}

configuration for container read-only; requires remove/create to change

func (*Config) AddArg

func (self *Config) AddArg(args ...string)

func (*Config) AddFlag

func (self *Config) AddFlag(name string, value interface{})

func (*Config) AddMount

func (self *Config) AddMount(name string, bind string, readonly bool)

func (*Config) Argv

func (self *Config) Argv() []string

func (Config) Equals

func (self Config) Equals(other Config) bool

Compare config against running config for compatibility The running config will include additional stuff from the image..

func (*Config) SetNetworkContainer

func (self *Config) SetNetworkContainer(id ID)

type Container

type Container struct {
	ContainerStatus

	// Config
	Config Config `json:"config"`

	// State
	// TODO: remove?
	ContainerState docker.State `json:"container_state"`
}

Running docker container

type ContainerStatus

type ContainerStatus struct {
	ID

	ContainerID string `json:"id"`
	Node        string `json:"node"`
	Name        string `json:"name"`

	Status   string `json:"status"` // human-readable
	State    string `json:"state"`  // machine-readable
	ExitCode int    `json:"exit_code"`
}

func (*ContainerStatus) IsError

func (self *ContainerStatus) IsError() bool

func (*ContainerStatus) IsUp

func (self *ContainerStatus) IsUp() bool

type ID

type ID struct {
	Class    string `json:"class"`
	Type     string `json:"type"`
	Instance string `json:"instance"`
}

func (ID) String

func (self ID) String() string

Docker name

type Info

type Info struct {
	Name            string
	ServerVersion   string
	OperatingSystem string

	Swarm *SwarmInfo
	Nodes []*NodeInfo
}

type Manager

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

func NewManager

func NewManager(options Options) (*Manager, error)

func (*Manager) Clean

func (manager *Manager) Clean(id ID) error

Clean up a docker container, removing it.

Force-stops running containers.

func (*Manager) Down

func (manager *Manager) Down(id ID) error

Stop docker container, if running. Ignored if already stopped.

Leaves the container in place, ready to be restarted

func (*Manager) Get

func (manager *Manager) Get(id string) (*Container, error)

Get complete container state for given container

func (*Manager) Info

func (manager *Manager) Info() (info Info, err error)

func (*Manager) List

func (manager *Manager) List(filter ID) (containers []ContainerStatus, err error)

Get short container status for given class

func (*Manager) Logs

func (manager *Manager) Logs(id string) (string, error)

func (*Manager) NewCache

func (manager *Manager) NewCache(eager bool) *Cache

func (*Manager) Panic

func (manager *Manager) Panic() (retErr error)

Force-kill all running managed containers

func (*Manager) Up

func (manager *Manager) Up(id ID, config Config) (*Container, error)

type MemoryInfo

type MemoryInfo struct {
	Size float64
	Unit string
}

type NodeInfo

type NodeInfo struct {
	Name string
	Addr string

	SwarmStatus  string
	SwarmError   error
	SwarmUpdated time.Time

	Containers     int
	CPU            int
	CPUReserved    int
	Memory         MemoryInfo
	MemoryReserved MemoryInfo
	Labels         map[string]string
}

type Options

type Options struct {
	DockerEndpoint string `long:"docker-endpoint"`

	Logger *log.Logger
}

type SwarmInfo

type SwarmInfo struct {
	Role      string
	Strategy  string
	NodeCount int `display:"Number of nodes"`
}

Jump to

Keyboard shortcuts

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