Documentation
¶
Overview ¶
A docker client library.
Index ¶
- Constants
- Variables
- type AttachOptions
- type BuildImageOptions
- type BuildResponse
- type DockerHost
- func (dh *DockerHost) AttachContainer(containerId string, opts *AttachOptions) (e error)
- func (dh *DockerHost) Build(r io.Reader, opts *BuildImageOptions) (imageId string, e error)
- func (dh *DockerHost) BuildDockerfile(dockerfile string, opts *BuildImageOptions) (imageId string, e error)
- func (dh *DockerHost) Container(containerId string) (containerInfo *docker.ContainerInfo, e error)
- func (dh *DockerHost) Containers() (containers []*docker.Container, e error)
- func (dh *DockerHost) CreateContainer(imageName string, options *docker.ContainerConfig, name string) (containerId string, e error)
- func (dh *DockerHost) DeleteImage(name string) error
- func (dh *DockerHost) ImageDetails(id string) (imageDetails *docker.ImageDetails, e error)
- func (dh *DockerHost) ImageHistory(id string) (imageHistory *docker.ImageHistory, e error)
- func (dh *DockerHost) Images() (images []*docker.Image, e error)
- func (dh *DockerHost) PullImage(name string) error
- func (dh *DockerHost) PushImage(name string) error
- func (dh *DockerHost) ServerVersion() (*Version, error)
- func (dh *DockerHost) StartContainer(containerId string, hostConfig *docker.HostConfig) (e error)
- func (dh *DockerHost) StopContainer(containerId string) (e error)
- func (dh *DockerHost) TagImage(imageId, repository, tag string) (e error)
- type ErrorDetail
- type JSONError
- type JSONMessage
- type JSONProgress
- type ProgressDetail
- type Version
Constants ¶
const FAKE_AUTH = `
{
"Auth": "fakeauth",
"Email": "fake@email.xx"
}
`
Variables ¶
var ErrorNotFound = fmt.Errorf("resource not found")
Functions ¶
This section is empty.
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 DockerHost ¶
type DockerHost struct { Registry string // Registry to use with this docker host. Logger *gologger.Logger // contains filtered or unexported fields }
func New ¶
func New(host string, port int) *DockerHost
Create a new connection to a docker host reachable at the given host and port.
func NewViaTunnel ¶
func NewViaTunnel(host, user string) (*DockerHost, error)
Create a new connection to a docker host using a SSH tunnel at the given user and host. This is useful as making the docker API public isn't recommended (allows to do stuff you don't want to allow publicly). A SSH connection will be set up and utilized for all communication to the docker API.
func (*DockerHost) AttachContainer ¶
func (dh *DockerHost) AttachContainer(containerId string, opts *AttachOptions) (e error)
Attach to the given container with the given writer.
func (*DockerHost) Build ¶
func (dh *DockerHost) Build(r io.Reader, opts *BuildImageOptions) (imageId string, e error)
Build a container image from a tar or tar.gz Reader
func (*DockerHost) BuildDockerfile ¶
func (dh *DockerHost) 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 (*DockerHost) Container ¶
func (dh *DockerHost) Container(containerId string) (containerInfo *docker.ContainerInfo, e error)
Get the information for the container with the given id.
func (*DockerHost) Containers ¶
func (dh *DockerHost) Containers() (containers []*docker.Container, e error)
Get a list of all ontainers available on the host.
func (*DockerHost) CreateContainer ¶
func (dh *DockerHost) CreateContainer(imageName string, 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 (*DockerHost) DeleteImage ¶
func (dh *DockerHost) DeleteImage(name string) error
Delete the given image from the docker host.
func (*DockerHost) ImageDetails ¶
func (dh *DockerHost) ImageDetails(id string) (imageDetails *docker.ImageDetails, e error)
Get the details for image with the given id (either hash or name).
func (*DockerHost) ImageHistory ¶
func (dh *DockerHost) ImageHistory(id string) (imageHistory *docker.ImageHistory, e error)
Get the given image's history.
func (*DockerHost) Images ¶
func (dh *DockerHost) Images() (images []*docker.Image, e error)
Get the list of all images available on the this host.
func (*DockerHost) PullImage ¶
func (dh *DockerHost) PullImage(name string) error
Pull the given image from the registry (part of the image name).
func (*DockerHost) PushImage ¶
func (dh *DockerHost) PushImage(name string) error
Push the given image to the registry. The name should be <registry>/<repository>.
func (*DockerHost) ServerVersion ¶
func (dh *DockerHost) ServerVersion() (*Version, error)
func (*DockerHost) StartContainer ¶
func (dh *DockerHost) 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 (*DockerHost) StopContainer ¶
func (dh *DockerHost) StopContainer(containerId string) (e error)
Kill the container with the given identifier.
func (*DockerHost) TagImage ¶
func (dh *DockerHost) TagImage(imageId, repository, tag string) (e error)
Tag the image with the given repository and tag. The tag is optional.
type ErrorDetail ¶
type JSONMessage ¶
type JSONMessage struct { Stream string `json:"stream,omitempty"` Status string `json:"status,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"` ProgressMessage string `json:"progress,omitempty"` //deprecated ID string `json:"id,omitempty"` From string `json:"from,omitempty"` Time int64 `json:"time,omitempty"` Error *JSONError `json:"errorDetail,omitempty"` ErrorMessage string `json:"error,omitempty"` //deprecated }