docker

package
v0.0.0-...-8335c39 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContainerName

func GetContainerName(serviceName string) string

GetContainerName returns the vci normalised container name

func GetImageName

func GetImageName(serviceName string) string

GetImageName returns the vci normalised image name

func HandleOutput

func HandleOutput(body io.ReadCloser, censored []string, writer io.Writer)

Types

type Container

type Container struct {
	// contains filtered or unexported fields
}

Container represents a runnable container

func NewContainer

func NewContainer(
	writer io.Writer,
	name string,
	image string,
	build *v3.DockerComposeServiceBuild,
	containerConfig *container.Config,
	hostConfig *container.HostConfig,
	networkAliases []string,
) *Container

NewContainer returns a new runnable container with the given parameters

func (*Container) Build

func (c *Container) Build(
	secrets []string,
	authConfigs map[string]types.AuthConfig,
	addressAuthToken map[string]string,
) error

Build builds the container

func (*Container) ConfigureNetwork

func (c *Container) ConfigureNetwork(networkID string) error

ConfigureNetwork updates the container's endpoint in the network to match its aliases

func (*Container) Create

func (c *Container) Create() error

Create creates the container in Docker

func (*Container) Get

func (c *Container) Get(secrets []string, authConfigs map[string]types.AuthConfig, authTokens map[string]string) error

Get will ensure that the container exists inside Docker by building or pulling it

func (*Container) Pull

func (c *Container) Pull(
	secrets []string,
	authConfigs map[string]types.AuthConfig,
	addressAuthToken map[string]string,
) error

Pull pulls the container

func (*Container) Run

func (c *Container) Run(wg *sync.WaitGroup, secrets []string, firstStoppedSvcCh chan string) error

Run runs the created container in Docker

func (*Container) Stop

func (c *Container) Stop() error

Stop stops the container with 1s of grace

type ContainerManager

type ContainerManager struct {
	// contains filtered or unexported fields
}

ContainerManager manages a set of containers

func NewContainerManager

func NewContainerManager(
	id string,
	registryAuthConfigs map[string]types.AuthConfig,
	registryAuthTokens map[string]string,
) *ContainerManager

NewContainerManager returns a new container manager

func (*ContainerManager) AddContainer

func (cM *ContainerManager) AddContainer(container *Container) error

AddContainer adds a container for the container manager to manager

func (*ContainerManager) Execute

func (cM *ContainerManager) Execute(secrets []string) error

Execute runs the containers

func (*ContainerManager) IsAllSuccessful

func (cM *ContainerManager) IsAllSuccessful() bool

IsAllSuccessful returns whether or not all of the services exited successfully

func (*ContainerManager) IsRunning

func (cM *ContainerManager) IsRunning() bool

IsRunning returns whether or not the containers are running

func (*ContainerManager) IsSuccessful

func (cM *ContainerManager) IsSuccessful() bool

IsSuccessful returns whether or not the first stopped service exited successfully

func (*ContainerManager) Stop

func (cM *ContainerManager) Stop() error

Stop interrupts running containers

type ImageBuilder

type ImageBuilder struct {
	// contains filtered or unexported fields
}

ImageBuilder represents a stoppable Docker image builder

func NewImageBuilder

func NewImageBuilder() *ImageBuilder

NewImageBuilder returns a new Docker image builder

func (*ImageBuilder) Build

func (iB *ImageBuilder) Build(
	writer io.Writer,
	secrets []string,
	buildContext string,
	dockerfile string,
	tags []string,
	authConfigs map[string]types.AuthConfig,
) error

Build builds a Docker image with the given parameters

func (*ImageBuilder) IsRunning

func (iB *ImageBuilder) IsRunning() bool

IsRunning returns whether or not the builder is running

func (*ImageBuilder) Stop

func (iB *ImageBuilder) Stop() error

Stop interrupts the build process

type ImagePusher

type ImagePusher struct {
	// contains filtered or unexported fields
}

Represents a stoppable Docker image pusher

func NewImagePusher

func NewImagePusher() *ImagePusher

NewImagePusher returns a new Docker image pusher

func (*ImagePusher) Push

func (iP *ImagePusher) Push(
	writer io.Writer,
	secrets []string,
	tag string,
	addressAuthTokens map[string]string,
) error

Push pushes a docker image with the given parameters

func (*ImagePusher) Stop

func (iP *ImagePusher) Stop()

Stop interrupts an image push process

Directories

Path Synopsis
compose
v3

Jump to

Keyboard shortcuts

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