Documentation ¶
Index ¶
- func AppendLatestTagIfNecessary(image string) string
- func EncodeCmds(cmds []string) string
- type ClientInterface
- type CopyFromContainerOptions
- type DockerManager
- func (dm *DockerManager) BuildImage(options docker_client.BuildImageOptions) error
- func (dm *DockerManager) CopyFromContainer(options CopyFromContainerOptions) error
- func (dm *DockerManager) ExecInContainer(options ExecOptions) error
- func (dm *DockerManager) IsImagePresent(image string) (bool, error)
- func (dm *DockerManager) PullImage(image string, auth docker_client.AuthConfiguration) error
- func (dm *DockerManager) PushImage(options docker_client.PushImageOptions, auth docker_client.AuthConfiguration) error
- func (dm *DockerManager) RemoveContainer(cid string) error
- func (dm *DockerManager) StartContainer(options docker_client.CreateContainerOptions, ...) (string, error)
- type ExecOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeCmds ¶
EncodeCmds encodes the build script as a command in the provided Container config. For linux, the build script is embedded as the container entrypoint command, base64 encoded as a one-line script.
Types ¶
type ClientInterface ¶
type ClientInterface interface { PullImage(opts docker_client.PullImageOptions, auth docker_client.AuthConfiguration) error InspectImage(name string) (*docker_client.Image, error) PushImage(opts docker_client.PushImageOptions, auth docker_client.AuthConfiguration) error BuildImage(opts docker_client.BuildImageOptions) error CreateContainer(opts docker_client.CreateContainerOptions) (*docker_client.Container, error) StartContainer(id string, hostConfig *docker_client.HostConfig) error RemoveContainer(opts docker_client.RemoveContainerOptions) error CreateExec(opts docker_client.CreateExecOptions) (*docker_client.Exec, error) StartExec(id string, opts docker_client.StartExecOptions) error InspectExec(id string) (*docker_client.ExecInspect, error) DownloadFromContainer(id string, opts docker_client.DownloadFromContainerOptions) error }
type CopyFromContainerOptions ¶
CopyFromContainerOptions specify parameters download resources from a container.
type DockerManager ¶
type DockerManager struct { // Client represets the Docker client. //Client *docker_client.Client Client ClientInterface EndPoint string AuthConfig *docker_client.AuthConfiguration }
DockerManager represents the manager of Docker, it packages the Docker client to easily use it. The Docker client can be direclty used for some functions not provided by this manager.
func NewDockerManager ¶
func NewDockerManager(endpoint, registryServer, registryUsername, registryPassword string) (*DockerManager, error)
func (*DockerManager) BuildImage ¶
func (dm *DockerManager) BuildImage(options docker_client.BuildImageOptions) error
BuildImage builds an image.
func (*DockerManager) CopyFromContainer ¶
func (dm *DockerManager) CopyFromContainer(options CopyFromContainerOptions) error
func (*DockerManager) ExecInContainer ¶
func (dm *DockerManager) ExecInContainer(options ExecOptions) error
func (*DockerManager) IsImagePresent ¶
func (dm *DockerManager) IsImagePresent(image string) (bool, error)
IsImagePresent checks if given image exists.
func (*DockerManager) PullImage ¶
func (dm *DockerManager) PullImage(image string, auth docker_client.AuthConfiguration) error
PullImage pulls an image by its name. Need to cover 3 cases: 1. Use auth of manager when not provided auth; 2. Use provided auth when image has prefix of server; 3. Use empty auth when image don't have prefix of server, this case is for Docker hub.
func (*DockerManager) PushImage ¶
func (dm *DockerManager) PushImage(options docker_client.PushImageOptions, auth docker_client.AuthConfiguration) error
PushImage pushes an image to a registry.
func (*DockerManager) RemoveContainer ¶
func (dm *DockerManager) RemoveContainer(cid string) error
RemoveContainer forcefully remove the container.
func (*DockerManager) StartContainer ¶
func (dm *DockerManager) StartContainer(options docker_client.CreateContainerOptions, auth docker_client.AuthConfiguration, logFile io.Writer, useDefaultStartCommand bool) (string, error)