Documentation
¶
Index ¶
- Constants
- Variables
- func CancelOnContainerCreated(id string) error
- func ImageHistory(uuid string) ([]*dockerclient.Image, error)
- func ImportImage(repotag, filename string) error
- func InspectImage(uuid string) (*dockerclient.Image, error)
- func Logs(dockerID string, args []string) error
- func OnContainerCreated(id string, action ContainerActionFunc) error
- func PullImage(repotag string) error
- func PushImage(repotag string) error
- func ServiceUse(serviceID string, imageName string, registry string, noOp bool) (string, error)
- func SetDockerClientGetter(getterOverride DockerClientGetter)
- func SetUseRegistry(ur bool)
- func UseRegistry() bool
- type Client
- func (c *Client) CommitContainer(opts dockerclient.CommitContainerOptions) (*dockerclient.Image, error)
- func (c *Client) CreateContainer(opts dockerclient.CreateContainerOptions) (*dockerclient.Container, error)
- func (c *Client) ExportContainer(opts dockerclient.ExportContainerOptions) error
- func (c *Client) ImportImage(opts dockerclient.ImportImageOptions) error
- func (c *Client) InspectContainer(id string) (*dockerclient.Container, error)
- func (c *Client) InspectImage(name string) (*dockerclient.Image, error)
- func (c *Client) KillContainer(opts dockerclient.KillContainerOptions) error
- func (c *Client) ListContainers(opts dockerclient.ListContainersOptions) ([]dockerclient.APIContainers, error)
- func (c *Client) ListImages(all bool) ([]dockerclient.APIImages, error)
- func (c *Client) MonitorEvents() (dockerclient.EventMonitor, error)
- func (c *Client) PullImage(opts dockerclient.PullImageOptions, auth dockerclient.AuthConfiguration) error
- func (c *Client) PushImage(opts dockerclient.PushImageOptions, auth dockerclient.AuthConfiguration) error
- func (c *Client) RemoveContainer(opts dockerclient.RemoveContainerOptions) error
- func (c *Client) RemoveImage(name string) error
- func (c *Client) RestartContainer(id string, timeout uint) error
- func (c *Client) StartContainer(id string, hostConfig *dockerclient.HostConfig) error
- func (c *Client) StopContainer(id string, timeout uint) error
- func (c *Client) TagImage(name string, opts dockerclient.TagImageOptions) error
- func (c *Client) WaitContainer(id string) (int, error)
- type ClientInterface
- type Container
- func (c *Container) CancelOnEvent(event string) error
- func (c *Container) Commit(iidstr string) (*Image, error)
- func (c *Container) Delete(volumes bool) error
- func (c *Container) Export(outfile *os.File) error
- func (c *Container) Inspect() (*dockerclient.Container, error)
- func (c *Container) IsRunning() bool
- func (c *Container) Kill() error
- func (c *Container) OnEvent(event string, action ContainerActionFunc) error
- func (c *Container) Restart(timeout time.Duration) error
- func (c *Container) Start(timeout time.Duration) error
- func (c *Container) Stop(timeout time.Duration) error
- func (c *Container) Wait(timeout time.Duration) (int, error)
- type ContainerActionFunc
- type ContainerDefinition
- type DockerClientGetter
- type Image
Constants ¶
const ( Create = dockerclient.Create Delete = dockerclient.Delete Destroy = dockerclient.Destroy Die = dockerclient.Die Export = dockerclient.Export Kill = dockerclient.Kill Restart = dockerclient.Restart Start = dockerclient.Start Stop = dockerclient.Stop Untag = dockerclient.Untag )
Strings identifying the Docker lifecycle events.
const (
Wildcard = "*"
)
Variables ¶
var ( ErrAlreadyStarted = errors.New("docker: container already started") ErrRequestTimeout = errors.New("docker: request timed out") ErrKernelShutdown = errors.New("docker: kernel shutdown") ErrNoSuchContainer = errors.New("docker: no such container") ErrNoSuchImage = errors.New("docker: no such image") )
Container subsystem error types
var DEFAULT_REGISTRY = "localhost:5000"
Functions ¶
func CancelOnContainerCreated ¶
CancelOnContainerCreated cancels any OnContainerCreated action associated with the specified id - docker.Wildcard is the only id that really makes sense.
func ImageHistory ¶
func ImageHistory(uuid string) ([]*dockerclient.Image, error)
func ImportImage ¶
ImportImage creates a new image in the local repository from a file system archive.
func InspectImage ¶
func InspectImage(uuid string) (*dockerclient.Image, error)
func OnContainerCreated ¶
func OnContainerCreated(id string, action ContainerActionFunc) error
OnContainerCreated associates a containter action with the specified container. The action will be triggered when that container is created; since we can't know before it's created what a containers id will be the only really useful id is docker.Wildcard which will cause the action to be triggered for every container docker creates.
func PushImage ¶
PushImage pushes an image by repotag to local registry, e.g., zenoss/devimg, from the local docker repository
func ServiceUse ¶
ServiceUse will tag a new image (imageName) in a given registry for a given tenant to latest, making sure to push changes to the registry
func SetDockerClientGetter ¶
func SetDockerClientGetter(getterOverride DockerClientGetter)
Used by tests that need to inject a mock or stub implementation of Client
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
This Client/ClientInterface is a shim for dockerclient.Client. All references to dockerclient.Client shoudl be isolated in Client/ClientInterface
func (*Client) CommitContainer ¶
func (c *Client) CommitContainer(opts dockerclient.CommitContainerOptions) (*dockerclient.Image, error)
func (*Client) CreateContainer ¶
func (c *Client) CreateContainer(opts dockerclient.CreateContainerOptions) (*dockerclient.Container, error)
func (*Client) ExportContainer ¶
func (c *Client) ExportContainer(opts dockerclient.ExportContainerOptions) error
func (*Client) ImportImage ¶
func (c *Client) ImportImage(opts dockerclient.ImportImageOptions) error
func (*Client) InspectContainer ¶
func (c *Client) InspectContainer(id string) (*dockerclient.Container, error)
func (*Client) InspectImage ¶
func (c *Client) InspectImage(name string) (*dockerclient.Image, error)
func (*Client) KillContainer ¶
func (c *Client) KillContainer(opts dockerclient.KillContainerOptions) error
func (*Client) ListContainers ¶
func (c *Client) ListContainers(opts dockerclient.ListContainersOptions) ([]dockerclient.APIContainers, error)
func (*Client) ListImages ¶
func (c *Client) ListImages(all bool) ([]dockerclient.APIImages, error)
func (*Client) MonitorEvents ¶
func (c *Client) MonitorEvents() (dockerclient.EventMonitor, error)
func (*Client) PullImage ¶
func (c *Client) PullImage(opts dockerclient.PullImageOptions, auth dockerclient.AuthConfiguration) error
func (*Client) PushImage ¶
func (c *Client) PushImage(opts dockerclient.PushImageOptions, auth dockerclient.AuthConfiguration) error
func (*Client) RemoveContainer ¶
func (c *Client) RemoveContainer(opts dockerclient.RemoveContainerOptions) error
func (*Client) RemoveImage ¶
func (*Client) StartContainer ¶
func (c *Client) StartContainer(id string, hostConfig *dockerclient.HostConfig) error
func (*Client) TagImage ¶
func (c *Client) TagImage(name string, opts dockerclient.TagImageOptions) error
type ClientInterface ¶
type ClientInterface interface { CommitContainer(opts dockerclient.CommitContainerOptions) (*dockerclient.Image, error) CreateContainer(opts dockerclient.CreateContainerOptions) (*dockerclient.Container, error) ExportContainer(opts dockerclient.ExportContainerOptions) error ImportImage(opts dockerclient.ImportImageOptions) error InspectContainer(id string) (*dockerclient.Container, error) InspectImage(name string) (*dockerclient.Image, error) KillContainer(opts dockerclient.KillContainerOptions) error ListContainers(opts dockerclient.ListContainersOptions) ([]dockerclient.APIContainers, error) ListImages(all bool) ([]dockerclient.APIImages, error) MonitorEvents() (dockerclient.EventMonitor, error) PullImage(opts dockerclient.PullImageOptions, auth dockerclient.AuthConfiguration) error PushImage(opts dockerclient.PushImageOptions, auth dockerclient.AuthConfiguration) error RemoveContainer(opts dockerclient.RemoveContainerOptions) error RemoveImage(name string) error RestartContainer(id string, timeout uint) error StartContainer(id string, hostConfig *dockerclient.HostConfig) error StopContainer(id string, timeout uint) error TagImage(name string, opts dockerclient.TagImageOptions) error WaitContainer(id string) (int, error) }
An interface respresentation of dockerclient.Client
func NewClient ¶
func NewClient(dockerRegistry string) (ClientInterface, error)
type Container ¶
type Container struct { *dockerclient.Container dockerclient.HostConfig }
Container represents a Docker container.
func Containers ¶
Containers retrieves a list of all the Docker containers.
func FindContainer ¶
FindContainer looks up a container using its id or name.
func NewContainer ¶
func NewContainer(cd *ContainerDefinition, start bool, timeout time.Duration, oncreate ContainerActionFunc, onstart ContainerActionFunc) (*Container, error)
NewContainer creates a new container and returns its id. The supplied create action, if any, will be executed on successful creation of the container. If a start action is specified it will be executed after the container has been started. Note, if the start parameter is false the container won't be started and the start action will not be executed.
func (*Container) CancelOnEvent ¶
CancelOnEvent cancels the action associated with the specified event.
func (*Container) Export ¶
Export writes the contents of the container's filesystem as a tar archive to outfile.
func (*Container) Inspect ¶
func (c *Container) Inspect() (*dockerclient.Container, error)
Inspect returns information about the container specified by id.
func (*Container) Kill ¶
Kill sends a SIGKILL signal to the container. If the container is not started no action is taken.
func (*Container) OnEvent ¶
func (c *Container) OnEvent(event string, action ContainerActionFunc) error
OnEvent adds an action for the specified event.
func (*Container) Start ¶
Start uses the information provided in the container definition cd to start a new Docker container. If a container can't be started before the timeout expires an error is returned.
type ContainerActionFunc ¶
type ContainerActionFunc func(id string)
ContainerActionFunc instances are used to handle container action notifications.
type ContainerDefinition ¶
type ContainerDefinition struct { dockerclient.CreateContainerOptions dockerclient.HostConfig }
ContainerDefinition records all the information necessary to create a Docker container.
type DockerClientGetter ¶
type DockerClientGetter func() (ClientInterface, error)
The function used to get an instance of ClientInterface
type Image ¶
Image represents a Docker image
func FindImage ¶
FindImage looks up an image by repotag, e.g., zenoss/devimg, from the local repository TODO: add a FindImageByFilter that returns collections of images