docker

package
v0.0.0-...-fa9893a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	GetIPAddress() string
	GetID() string
}

IService represents an ephemeral Docker container. It mainly serves to simplify the Docker container API.

type IServiceSpecification

type IServiceSpecification interface {
	GetFullyQualifiedImageName() string
	GetContainerConfig() *container.Config
	GetHostConfig() *container.HostConfig
}

IServiceSpecification defines the necessary data for creating a Service

type Loader

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

Loader wraps a docker Client and exposes a simpler interface for creating ephemeral Services

func NewLoader

func NewLoader() (Loader, error)

NewLoader creates a Docker Client and returns a new Loader

func NewLoaderFromClient

func NewLoaderFromClient(dockerClient *client.Client) Loader

NewLoaderFromClient creates a Loader from a docker Client

func (Loader) Close

func (l Loader) Close() error

Close closes the socket used to contact the Docker API

func (Loader) StartService

func (l Loader) StartService(ctx context.Context, spec IServiceSpecification) (Service, error)

StartService creates a new Service from a given service specification. The process is cancellable with a context.

func (Loader) StopService

func (l Loader) StopService(ctx context.Context, service IService) error

StopService stops and removes a Service. Blocks until container is removed.

type Service

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

Service provides a concrete implementation for IService. Service may be embedded into specific Container types to implement IService

func (Service) GetID

func (s Service) GetID() string

GetID returns the Service's Docker ID

func (Service) GetIPAddress

func (s Service) GetIPAddress() string

GetIPAddress returns the Service's internal IP Address accessible from the Docker host.

type ServiceSpecification

type ServiceSpecification struct {
	FullyQualifiedImageName string
	ContainerConfig         *container.Config
	HostConfig              *container.HostConfig
}

ServiceSpecification provides a simple implementation of IServiceSpecification

func (*ServiceSpecification) GetContainerConfig

func (s *ServiceSpecification) GetContainerConfig() *container.Config

GetContainerConfig returns the specification's container configuration. This contains host independant configuration details.

func (*ServiceSpecification) GetFullyQualifiedImageName

func (s *ServiceSpecification) GetFullyQualifiedImageName() string

GetFullyQualifiedImageName returns an image's fully qualified name i.e. "library/hello-world"

func (*ServiceSpecification) GetHostConfig

func (s *ServiceSpecification) GetHostConfig() *container.HostConfig

GetHostConfig returns the specification's host dependant configuration such as bind mounts.

Jump to

Keyboard shortcuts

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