docker

package module
v0.0.0-...-aeddd43 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2013 License: BSD-2-Clause Imports: 16 Imported by: 0

README

#go-dockerclient

Build Status Build Status

This package presents a client for the Docker remote API.

For more details, check the remote API documentation: http://docs.docker.io/en/latest/api/docker_remote_api.

Documentation

Overview

Package docker provides a client for the Docker remote API.

See http://goo.gl/mxyql for more details on the remote API.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidEndpoint is returned when the endpoint is not a valid HTTP URL.
	ErrInvalidEndpoint = errors.New("Invalid endpoint")

	// ErrConnectionRefused is returned when the client cannot connect to the given endpoint.
	ErrConnectionRefused = errors.New("Cannot connect to Docker endpoint")
)
View Source
var ErrNoSuchImage = errors.New("No such image")

Error returned when the image does not exist.

Functions

This section is empty.

Types

type AttachToContainerOptions

type AttachToContainerOptions struct {
	Container    string
	InputFile    *os.File
	OutputStream io.Writer
	ErrorStream  io.Writer
	RawTerminal  bool

	// Get container logs, sending it to OutputStream.
	Logs bool

	// Stream the response?
	Stream bool

	// Attach to stdin, and use InputFile.
	Stdin bool

	// Attach to stdout, and use OutputStream.
	Stdout bool

	// Attach to stderr, and use ErrorStream.
	Stderr bool
}

AttachToContainerOptions is the set of options that can be used when attaching to a container.

See http://goo.gl/APgKE for more details.

type Client

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

Client is the basic type of this package. It provides methods for interaction with the API.

func NewClient

func NewClient(endpoint string) (*Client, error)

NewClient returns a Client instance ready for communication with the given server endpoint.

func (*Client) AttachToContainer

func (c *Client) AttachToContainer(opts AttachToContainerOptions) error

AttachToContainer attaches to a container, using the given options.

See http://goo.gl/APgKE for more details.

func (*Client) CommitContainer

func (c *Client) CommitContainer(opts CommitContainerOptions) (*docker.Image, error)

CommitContainer creates a new image from a container's changes.

See http://goo.gl/qYrAF for more details.

func (*Client) CreateContainer

func (c *Client) CreateContainer(config *docker.Config) (*docker.Container, error)

CreateContainer creates a new container, returning the container instance, or an error in case of failure.

See http://goo.gl/lcR51 for more details.

func (*Client) Info

func (c *Client) Info() (*docker.APIInfo, error)

Info returns system-wide information, like the number of running containers.

See http://goo.gl/9eYZF for more details.

func (*Client) InspectContainer

func (c *Client) InspectContainer(id string) (*docker.Container, error)

InspectContainer returns information about a container by its ID.

See http://goo.gl/g5tpG for more details.

func (*Client) InspectImage

func (c *Client) InspectImage(name string) (*docker.Image, error)

InspectImage returns an image by its name or ID.

See http://goo.gl/dqGQO for more details.

func (*Client) KillContainer

func (c *Client) KillContainer(id string) error

KillContainer kills a container, returning an error in case of failure.

See http://goo.gl/DfPJC for more details.

func (*Client) ListContainers

func (c *Client) ListContainers(opts ListContainersOptions) ([]docker.APIContainers, error)

ListContainers returns a slice of containers matching the given criteria.

See http://goo.gl/8IMr2 for more details.

func (*Client) ListImages

func (c *Client) ListImages(all bool) ([]docker.APIImages, error)

ListImages returns the list of available images in the server.

See http://goo.gl/5ZfHk for more details.

func (*Client) PullImage

func (c *Client) PullImage(opts PullImageOptions, w io.Writer) error

PullImage pulls an image from a remote registry, logging progress to w.

See http://goo.gl/JSltN for more details.

func (*Client) PushImage

func (c *Client) PushImage(opts PushImageOptions, w io.Writer) error

PushImage pushes an image to a remote registry, logging progress to w.

See http://goo.gl/Hx3CB for more details.

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(id string) error

RemoveContainer removes a container, returning an error in case of failure.

See http://goo.gl/vCybY for more details.

func (*Client) RemoveImage

func (c *Client) RemoveImage(name string) error

RemoveImage removes an image by its name or ID.

See http://goo.gl/J2FNF for more details.

func (*Client) RestartContainer

func (c *Client) RestartContainer(id string, timeout uint) error

RestartContainer stops a container, killing it after the given timeout (in seconds), during the stop process.

See http://goo.gl/n3S9r for more details.

func (*Client) StartContainer

func (c *Client) StartContainer(id string) error

StartContainer starts a container, returning an errror in case of failure.

See http://goo.gl/QipuL for more details.

func (*Client) StopContainer

func (c *Client) StopContainer(id string, timeout uint) error

StopContainer stops a container, killing it after the given timeout (in seconds).

See http://goo.gl/bXrXM for more details.

func (*Client) Version

func (c *Client) Version() (*docker.APIVersion, error)

Version returns version information about the docker server.

func (*Client) WaitContainer

func (c *Client) WaitContainer(id string) (int, error)

WaitContainer blocks until the given container stops, return the exit code of the container status.

See http://goo.gl/MtAmo for more details.

type CommitContainerOptions

type CommitContainerOptions struct {
	Container  string
	Repository string `qs:"repo"`
	Tag        string
	Message    string `qs:"m"`
	Author     string
	Run        *docker.Config
}

CommitContainerOptions aggregates parameters to the CommitContainer method.

See http://goo.gl/qYrAF for more details.

type Error

type Error struct {
	Status  int
	Message string
}

Error represents failures in the API. It represents a failure from the API.

func (*Error) Error

func (e *Error) Error() string

type ListContainersOptions

type ListContainersOptions struct {
	All    bool
	Size   bool
	Limit  int
	Since  string
	Before string
}

ListContainersOptions specify parameters to the ListContainers function.

See http://goo.gl/8IMr2 for more details.

type NoSuchContainer

type NoSuchContainer struct {
	ID string
}

NoSuchContainer is the error returned when a given container does not exist.

func (*NoSuchContainer) Error

func (err *NoSuchContainer) Error() string

type PullImageOptions

type PullImageOptions struct {
	Repository string `qs:"fromImage"`
	Registry   string
}

PullImageOptions present the set of options available for pulling an image from a registry.

See http://goo.gl/JSltN for more details.

type PushImageOptions

type PushImageOptions struct {
	// Name of the image
	Name string

	// Registry server to push the image
	Registry string
}

PushImageOptions options to use in the PushImage method.

Directories

Path Synopsis
Package testing provides a fake implementation of the Docker API, useful for testing purpose.
Package testing provides a fake implementation of the Docker API, useful for testing purpose.

Jump to

Keyboard shortcuts

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