docker

package
v0.0.0-...-80c4230 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2014 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVERSION        = 1.9
	DEFAULTHTTPPORT   = 4243
	DEFAULTUNIXSOCKET = "/var/run/docker.sock"
	DEFAULTPROTOCOL   = "unix"
	DEFAULTTAG        = "latest"
	VERSION           = "0.8.0"
)

Variables

View Source
var (
	// Returned if the specified resource does not exist.
	ErrNotFound = errors.New("Not Found")

	// Returned if the caller attempts to make a call or modify a resource
	// for which the caller is not authorized.
	//
	// The request was a valid request, the caller's authentication credentials
	// succeeded but those credentials do not grant the caller permission to
	// access the resource.
	ErrForbidden = errors.New("Forbidden")

	// Returned if the call requires authentication and either the credentials
	// provided failed or no credentials were provided.
	ErrNotAuthorized = errors.New("Unauthorized")

	// Returned if the caller submits a badly formed request. For example,
	// the caller can receive this return if you forget a required parameter.
	ErrBadRequest = errors.New("Bad Request")
)
View Source
var Logging = true

Enables verbose logging to the Terminal window

Functions

This section is empty.

Types

type Client

type Client struct {
	Images     *ImageService
	Containers *ContainerService
	// contains filtered or unexported fields
}

func New

func New() *Client

New creates an instance of the Docker Client

type Config

type Config struct {
	Hostname        string
	Domainname      string
	User            string
	Memory          int64 // Memory limit (in bytes)
	MemorySwap      int64 // Total memory usage (memory + swap); set `-1' to disable swap
	CpuShares       int64 // CPU shares (relative weight vs. other containers)
	AttachStdin     bool
	AttachStdout    bool
	AttachStderr    bool
	PortSpecs       []string // Deprecated - Can be in the format of 8080/tcp
	ExposedPorts    map[Port]struct{}
	Tty             bool // Attach standard streams to a tty, including stdin if it is not closed.
	OpenStdin       bool // Open stdin
	StdinOnce       bool // If true, close stdin after the 1 attached client disconnects.
	Env             []string
	Cmd             []string
	Dns             []string
	Image           string // Name of the image as it was passed by the operator (eg. could be symbolic)
	Volumes         map[string]struct{}
	VolumesFrom     string
	WorkingDir      string
	Entrypoint      []string
	NetworkDisabled bool
}

type Container

type Container struct {
	ID string

	Created time.Time

	Path string
	Args []string

	Config *Config
	State  State
	Image  string

	NetworkSettings *NetworkSettings

	SysInitPath    string
	ResolvConfPath string
	HostnamePath   string
	HostsPath      string
	Name           string
	Driver         string

	Volumes map[string]string
	// Store rw/ro in a separate structure to preserve reverse-compatibility on-disk.
	// Easier than migrating older container configs :)
	VolumesRW map[string]bool
}

type ContainerService

type ContainerService struct {
	*Client
}

func (*ContainerService) Attach

func (c *ContainerService) Attach(id string, out io.Writer) error

Attach to the container to stream the stdout and stderr

func (*ContainerService) Create

func (c *ContainerService) Create(conf *Config) (*Run, error)

Create a Container

func (*ContainerService) Inspect

func (c *ContainerService) Inspect(id string) (*Container, error)

Stop the container id

func (*ContainerService) List

func (c *ContainerService) List() ([]*Containers, error)

List only running containers.

func (*ContainerService) ListAll

func (c *ContainerService) ListAll() ([]*Containers, error)

List all containers

func (*ContainerService) Remove

func (c *ContainerService) Remove(id string) error

Remove the container id from the filesystem.

func (*ContainerService) Run

func (c *ContainerService) Run(conf *Config, host *HostConfig, out io.Writer) (*Wait, error)

Run the container

func (*ContainerService) RunDaemon

func (c *ContainerService) RunDaemon(conf *Config, host *HostConfig) (*Run, error)

Run the container as a Daemon

func (*ContainerService) RunDaemonPorts

func (c *ContainerService) RunDaemonPorts(image string, ports ...string) (*Run, error)

func (*ContainerService) Start

func (c *ContainerService) Start(id string, conf *HostConfig) error

Start the container id

func (*ContainerService) Stop

func (c *ContainerService) Stop(id string, timeout int) error

Stop the container id

func (*ContainerService) Wait

func (c *ContainerService) Wait(id string) (*Wait, error)

Block until container id stops, then returns the exit code

type Containers

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

type Delete

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

type HostConfig

type HostConfig struct {
	Binds           []string
	ContainerIDFile string
	LxcConf         []KeyValuePair
	Privileged      bool
	PortBindings    map[Port][]PortBinding
	Links           []string
	PublishAllPorts bool
}

type Image

type Image struct {
	ID              string    `json:"id"`
	Parent          string    `json:"parent,omitempty"`
	Comment         string    `json:"comment,omitempty"`
	Created         time.Time `json:"created"`
	Container       string    `json:"container,omitempty"`
	ContainerConfig Config    `json:"container_config,omitempty"`
	DockerVersion   string    `json:"docker_version,omitempty"`
	Author          string    `json:"author,omitempty"`
	Config          *Config   `json:"config,omitempty"`
	Architecture    string    `json:"architecture,omitempty"`
	OS              string    `json:"os,omitempty"`
	Size            int64
}

type ImageService

type ImageService struct {
	*Client
}

func (*ImageService) Build

func (c *ImageService) Build(tag, dir string) error

Build the Image

func (*ImageService) Create

func (c *ImageService) Create(image string) error

Create an image, either by pull it from the registry or by importing it.

func (*ImageService) Inspect

func (c *ImageService) Inspect(name string) (*Image, error)

Inspect the image

func (*ImageService) List

func (c *ImageService) List() ([]*Images, error)

List Images

func (*ImageService) Pull

func (c *ImageService) Pull(image string) error

func (*ImageService) PullTag

func (c *ImageService) PullTag(name, tag string) error

func (*ImageService) Remove

func (c *ImageService) Remove(image string) ([]*Delete, error)

Remove the image name from the filesystem

type Images

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

	// DEPRECATED
	Repository string `json:",omitempty"`
	Tag        string `json:",omitempty"`
}

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value string
}

type NetworkSettings

type NetworkSettings struct {
	IPAddress   string
	IPPrefixLen int
	Gateway     string
	Bridge      string
	PortMapping map[string]PortMapping // Deprecated
	Ports       map[Port][]PortBinding
}

type Port

type Port string

80/tcp

func NewPort

func NewPort(proto, port string) Port

func (Port) Int

func (p Port) Int() int

func (Port) Port

func (p Port) Port() string

func (Port) Proto

func (p Port) Proto() string

type PortBinding

type PortBinding struct {
	HostIp   string
	HostPort string
}

type PortMapping

type PortMapping map[string]string // Deprecated

type Run

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

type State

type State struct {
	Running    bool
	Pid        int
	ExitCode   int
	StartedAt  time.Time
	FinishedAt time.Time
	Ghost      bool
}

type Top

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

type Wait

type Wait struct {
	StatusCode int
}

Jump to

Keyboard shortcuts

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