Documentation ¶
Overview ¶
A docker client library.
Index ¶
- Constants
- Variables
- func HandlePullImageMessage(msg *JSONMessage)
- type AttachOptions
- type BuildImageOptions
- type BuildResponse
- type Client
- func (dh *Client) AttachContainer(containerId string, opts *AttachOptions) (e error)
- func (dh *Client) Build(r io.Reader, opts *BuildImageOptions) (imageId string, e error)
- func (dh *Client) BuildDockerfile(dockerfile string, opts *BuildImageOptions) (imageId string, e error)
- func (dh *Client) Container(containerId string) (containerInfo *docker.ContainerInfo, e error)
- func (dh *Client) Containers() (containers []*docker.Container, e error)
- func (dh *Client) CreateContainer(options *docker.ContainerConfig, name string) (containerId string, e error)
- func (dh *Client) DeleteImage(name string) error
- func (dh *Client) HostInfo() (*DockerHostInfo, error)
- func (dh *Client) ImageDetails(id string) (imageDetails *docker.ImageDetails, e error)
- func (dh *Client) ImageHistory(id string) (imageHistory *docker.ImageHistory, e error)
- func (dh *Client) Images() (images []*docker.Image, e error)
- func (dh *Client) ListContainers(opts *ListContainersOptions) (containers []*docker.Container, e error)
- func (dh *Client) PullFromImage(image string, handler func(*JSONMessage)) error
- func (dh *Client) PullImage(name string) error
- func (dh *Client) PushImage(name string, opts *PushImageOptions) error
- func (dh *Client) RemoveContainer(containerId string) error
- func (dh *Client) StartContainer(containerId string, hostConfig *docker.HostConfig) (e error)
- func (dh *Client) StopContainer(containerId string) (e error)
- func (dh *Client) TagImage(imageId, repository, tag string) (e error)
- type DockerHostInfo
- type ErrorDetail
- type JSONError
- type JSONMessage
- type JSONProgress
- type ListContainersOptions
- type ProgressDetail
- type PushImageOptions
Constants ¶
const FAKE_AUTH = `
{
"Auth": "fakeauth",
"Email": "fake@email.xx"
}
`
Variables ¶
var ErrorNotFound = fmt.Errorf("resource not found")
Functions ¶
func HandlePullImageMessage ¶
func HandlePullImageMessage(msg *JSONMessage)
Types ¶
type AttachOptions ¶
func (*AttachOptions) Encode ¶
func (opts *AttachOptions) Encode() string
type BuildImageOptions ¶
type BuildImageOptions struct { Tag string Quite bool NoCache bool Callback func(s *JSONMessage) }
type BuildResponse ¶
type BuildResponse []*JSONMessage
func (BuildResponse) ImageId ¶
func (rsp BuildResponse) ImageId() string
func (BuildResponse) Last ¶
func (rsp BuildResponse) Last() *JSONMessage
type Client ¶
type Client struct { Address string Client *http.Client // http client used to send requests to the host. }
func (*Client) AttachContainer ¶
func (dh *Client) AttachContainer(containerId string, opts *AttachOptions) (e error)
Attach to the given container with the given writer.
func (*Client) BuildDockerfile ¶
func (dh *Client) BuildDockerfile(dockerfile string, opts *BuildImageOptions) (imageId string, e error)
Create a new image from the given dockerfile. If name is non empty the new image is named accordingly. If a writer is given it is used to send the docker output to.
func (*Client) Container ¶
func (dh *Client) Container(containerId string) (containerInfo *docker.ContainerInfo, e error)
Get the information for the container with the given id.
func (*Client) Containers ¶
Get a list of all ontainers available on the host.
func (*Client) CreateContainer ¶
func (dh *Client) CreateContainer(options *docker.ContainerConfig, name string) (containerId string, e error)
For the given image name and the given container configuration, create a container. If the image name deosn't contain a tag "latest" is used by default.
func (*Client) DeleteImage ¶
Delete the given image from the docker host.
func (*Client) HostInfo ¶
func (dh *Client) HostInfo() (*DockerHostInfo, error)
func (*Client) ImageDetails ¶
func (dh *Client) ImageDetails(id string) (imageDetails *docker.ImageDetails, e error)
Get the details for image with the given id (either hash or name).
func (*Client) ImageHistory ¶
func (dh *Client) ImageHistory(id string) (imageHistory *docker.ImageHistory, e error)
Get the given image's history.
func (*Client) ListContainers ¶
func (dh *Client) ListContainers(opts *ListContainersOptions) (containers []*docker.Container, e error)
func (*Client) PullFromImage ¶
func (dh *Client) PullFromImage(image string, handler func(*JSONMessage)) error
func (*Client) PushImage ¶
func (dh *Client) PushImage(name string, opts *PushImageOptions) error
Push the given image to the registry. The name should be <registry>/<repository>.
func (*Client) RemoveContainer ¶
func (*Client) StartContainer ¶
func (dh *Client) StartContainer(containerId string, hostConfig *docker.HostConfig) (e error)
Start the container with the given identifier. The hostConfig can safely be set to nil to use the defaults.
func (*Client) StopContainer ¶
Kill the container with the given identifier.
type DockerHostInfo ¶
type DockerHostInfo struct { Containers int Images int Driver string DriverStatus [][]string ExecutionDriver string KernelVersion string NCPU int MemTotal int Name string ID string NFd int NGoroutines int NEventsListener int InitPath string InitSha1 string IndexServerAddress string MemoryLimit int SwapLimit int Labels []string DockerRootDir string OperatingSystem string }
type ErrorDetail ¶
type JSONMessage ¶
type JSONMessage struct { Stream string `json:"stream,omitempty"` Status string `json:"status,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"` Id string `json:"id,omitempty"` From string `json:"from,omitempty"` Time int64 `json:"time,omitempty"` Error *JSONError `json:"errorDetail,omitempty"` }
func (*JSONMessage) Err ¶
func (msg *JSONMessage) Err() error
type JSONProgress ¶
type ListContainersOptions ¶
func (*ListContainersOptions) Encode ¶
func (opts *ListContainersOptions) Encode() string
type ProgressDetail ¶
type PushImageOptions ¶
type PushImageOptions struct {
Callback func(s *JSONMessage)
}