crocker

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2014 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

The crocker package provides an abstract container system.

Crocker is based on wrapping docker, and internally, operates by exec'ing docker commands and the CLI interface. The Crocker API conceals the fact that it uses the exec cli, and may in the future be transparently reimplemented to use other docker APIs.

Index

Constants

View Source
const ApiVersion = "1.10" //Docker api version
View Source
const DefaultTag = "latest"

The default docker tag

View Source
const ServerVersion = "0.10.0" //Docker header version so its log can complain :)
View Source
const TempDir = "/tmp"

Where to place & call CIDfiles

View Source
const TempPrefix = "trion-"

Variables

This section is empty.

Functions

func CreateCIDfile

func CreateCIDfile() string

Create a temporary file for docker to print its CID to

func PollCid

func PollCid(filename string) chan string

Given a filename that docker prints a ContainerID to, poll for file and write that CID to a channel.

This defeats the rather insane problem caused by docker not really writing the CIDfile at any particular time...

func SplitImageName

func SplitImageName(image string) (string, string)

Given an image string, returns the image name and tag.

'ubuntu:12.10' -> 'ubuntu', '12.10'
'ubuntu' -> 'ubuntu', 'latest'

Types

type APIAuth

type APIAuth struct {
	Status string
}

type APIContainers

type APIContainers struct {
	ID         string `json:"Id"`
	Image      string
	Command    string
	Created    int64
	Status     string
	Ports      []APIPort
	SizeRw     int64
	SizeRootFs int64
}

type APIContainersOld

type APIContainersOld struct {
	ID         string `json:"Id"`
	Image      string
	Command    string
	Created    int64
	Status     string
	Ports      string
	SizeRw     int64
	SizeRootFs int64
}

type APICopy

type APICopy struct {
	Resource string
	HostPath string
}

type APIHistory

type APIHistory struct {
	ID        string   `json:"Id"`
	Tags      []string `json:",omitempty"`
	Created   int64
	CreatedBy string `json:",omitempty"`
}

type APIID

type APIID struct {
	ID string `json:"Id"`
}

type APIImages

type APIImages struct {
	RepoTags    []string `json:",omitempty"`
	ID          string   `json:"Id"`
	Created     int64
	Size        int64
	VirtualSize int64
}

type APIInfo

type APIInfo struct {
	Debug              bool
	Containers         int
	Images             int
	NFd                int    `json:",omitempty"`
	NGoroutines        int    `json:",omitempty"`
	MemoryLimit        bool   `json:",omitempty"`
	SwapLimit          bool   `json:",omitempty"`
	IPv4Forwarding     bool   `json:",omitempty"`
	LXCVersion         string `json:",omitempty"`
	NEventsListener    int    `json:",omitempty"`
	KernelVersion      string `json:",omitempty"`
	IndexServerAddress string `json:",omitempty"`
}

type APIPort

type APIPort struct {
	PrivatePort int64
	PublicPort  int64
	Type        string
}

func (*APIPort) MarshalJSON

func (port *APIPort) MarshalJSON() ([]byte, error)

type APIRmi

type APIRmi struct {
	Deleted  string `json:",omitempty"`
	Untagged string `json:",omitempty"`
}

type APIRun

type APIRun struct {
	ID       string   `json:"Id"`
	Warnings []string `json:",omitempty"`
}

type APISearch

type APISearch struct {
	Name        string
	Description string
}

type APITop

type APITop struct {
	Titles    []string
	Processes [][]string
}

type APIVersion

type APIVersion struct {
	Version   string
	GitCommit string `json:",omitempty"`
	GoVersion string `json:",omitempty"`
}

type APIWait

type APIWait struct {
	StatusCode int
}

type Container

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

Refers to a Container process. The container has been started and has an ID. Methods on this struct can be used to inspect and manipulate the container.

func Launch

func Launch(dock *Dock, image string, command []string, attach bool, privileged bool, startIn string, dns []string, mounts [][]string, ports [][]string, environment [][]string) *Container

Launches a new Container in the given Dock. Punting on documentation while things are in flux; see command.go struct for details.

func (*Container) Commit

func (c *Container) Commit(name, tag string)

Commits the container.

func (*Container) Export

func (c *Container) Export(writer io.Writer)

Streams out a tar as produced by `docker export`.

func (*Container) ExportToFilename

func (c *Container) ExportToFilename(path string)

Convenience wrapper for Export(io.Writer) but writing to a file.

func (*Container) Purge

func (c *Container) Purge()

Discards the container state and filesystem (i.e., wraps `docker rm`).

After this method completes, many other inspection methods on this Container become invalid and will error, because the backing data has been, well, purged.

This will error if called on a still-running container.

func (*Container) Wait

func (c *Container) Wait()

Waits for the container's main process to exit (i.e., wraps `docker wait`).

type Dock

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

A struct representing a connection to a docker daemon

func Dial added in v0.5.2

func Dial(uri string) *Dock

Engage chevrons

func (*Dock) Call added in v0.5.2

func (dock *Dock) Call(method, path string, data interface{}) ([]byte, int)

Hit the docker daemon with an HTTP request, returns response byte array

func (*Dock) CheckCache

func (dock *Dock) CheckCache(image string) bool

Check if an image is loaded in docker's cache.

func (*Dock) Close added in v0.5.2

func (dock *Dock) Close()

Close the socket if it's open

func (*Dock) Cmd added in v0.5.2

func (dock *Dock) Cmd() Command

Returns a gosh command struct for use in exec-wrapping docker

func (*Dock) Import

func (dock *Dock) Import(reader io.Reader, name string, tag string)

Import an image into repository, caching the expanded form so that it's ready to be used as a base filesystem for containers.

func (*Dock) ImportFromFilename

func (dock *Dock) ImportFromFilename(path string, name string, tag string)

func (*Dock) ImportFromFilenameTagstring

func (dock *Dock) ImportFromFilenameTagstring(path, image string)

Import an image from a docker-style image string, such as 'ubuntu:latest'

func (*Dock) PrintVersion added in v0.5.3

func (dock *Dock) PrintVersion()

Run the simple docker version command for debugging

func (*Dock) Pull

func (dock *Dock) Pull(image string)

Jump to

Keyboard shortcuts

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