docker

package
v0.7.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendLatestTagIfNecessary

func AppendLatestTagIfNecessary(image string) string

func EncodeCmds

func EncodeCmds(cmds []string) string

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 CopyFromContainerOptions

type CopyFromContainerOptions struct {
	Container     string
	HostPath      string
	ContainerPath string
}

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

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)

type ExecOptions

type ExecOptions struct {
	AttachStdin  bool
	AttachStdout bool
	AttachStderr bool
	Cmd          []string
	Container    string
	User         string

	// InputStream  io.Reader
	OutputStream io.Writer
	ErrorStream  io.Writer
}

ExecOptions specify parameters to the ExecInContainer function.

Directories

Path Synopsis
Package mock_docker is a generated GoMock package.
Package mock_docker is a generated GoMock package.

Jump to

Keyboard shortcuts

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