docker

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPGImage      = "docker.io/library/postgres:alpine"
	DefaultRabbitImage  = "docker.io/library/rabbitmq:alpine"
	DefaultElasticImage = "docker.io/library/elasticsearch:6.8.4"
)

Variables

This section is empty.

Functions

func CleanupByBackup added in v1.6.0

func CleanupByBackup() error

func NewClient

func NewClient() (*ispDockerClient, error)

Types

type ContainerContext

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

func (*ContainerContext) Close

func (ctx *ContainerContext) Close() error

force delete container and image

func (*ContainerContext) ForceRemoveContainer

func (ctx *ContainerContext) ForceRemoveContainer() error

func (*ContainerContext) ForceRemoveImage

func (ctx *ContainerContext) ForceRemoveImage() error

func (*ContainerContext) GetIPAddress added in v1.1.0

func (ctx *ContainerContext) GetIPAddress() string

func (*ContainerContext) StartContainer added in v1.3.0

func (ctx *ContainerContext) StartContainer() error

StartContainer sends a request to the docker daemon to start a container.

func (*ContainerContext) StopContainer added in v1.3.0

func (ctx *ContainerContext) StopContainer(timeout time.Duration) error

StopContainer stops a container without terminating the process. The process is blocked until the container stops or the timeout expires.

type NetworkContext

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

func (*NetworkContext) Close

func (ctx *NetworkContext) Close() error

type Option

type Option func(opts *options)

func PullImage

func PullImage(registryLogin string, registryPassword string) Option

if set image pulls first, registryLogin and registryPassword are optional

func WithCustomImage added in v1.1.0

func WithCustomImage(image string) Option

func WithEnv

func WithEnv(vars map[string]string) Option

set environments variables

func WithLogger

func WithLogger(logger io.Writer) Option

redirect docker container runtime logs

func WithName

func WithName(containerName string) Option

set container name and hostname in docker network by default

func WithNetwork

func WithNetwork(ctx *NetworkContext) Option

if set, container joins to specified network

func WithPortBindings

func WithPortBindings(mapping map[string]string) Option

bind ports host_machine_port -> container_exposed_port

func WithVolumes added in v1.0.1

func WithVolumes(volume map[string]string) Option

type TestEnvironment added in v1.1.0

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

func NewTestEnvironment added in v1.1.0

func NewTestEnvironment(testCtx *ctx.TestContext, cli *ispDockerClient) *TestEnvironment

func (*TestEnvironment) Cleanup added in v1.1.0

func (te *TestEnvironment) Cleanup() error

func (*TestEnvironment) Network added in v1.1.0

func (te *TestEnvironment) Network() *NetworkContext

func (*TestEnvironment) RunAppContainer added in v1.1.0

func (te *TestEnvironment) RunAppContainer(image string, localConfig interface{}, remoteConfig interface{}, opts ...Option) *ContainerContext

func (*TestEnvironment) RunConfigServiceContainer added in v1.1.0

func (te *TestEnvironment) RunConfigServiceContainer(opts ...Option) (*ContainerContext, structure.AddressConfiguration)

func (*TestEnvironment) RunElasticContainer added in v1.1.0

func (te *TestEnvironment) RunElasticContainer(opts ...Option) (*ContainerContext, structure.ElasticConfiguration)

func (*TestEnvironment) RunPGContainer added in v1.1.0

func (te *TestEnvironment) RunPGContainer(opts ...Option) (*ContainerContext, structure.DBConfiguration)

func (*TestEnvironment) RunRabbitContainer added in v1.1.0

func (te *TestEnvironment) RunRabbitContainer(opts ...Option) (*ContainerContext, mq.Config)

Jump to

Keyboard shortcuts

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