Documentation ¶
Index ¶
- Constants
- Variables
- type ContainerRunner
- func (e *ContainerRunner) Start(ctx context.Context) error
- func (e *ContainerRunner) Stop(ctx context.Context) error
- func (r *ContainerRunner) WithEnvironmentVariable(key, val string) *ContainerRunner
- func (r *ContainerRunner) WithImage(image string) *ContainerRunner
- func (r *ContainerRunner) WithName(name string) *ContainerRunner
- func (r *ContainerRunner) WithOptions(opts *ContainerRunnerOpts) *ContainerRunner
- func (r *ContainerRunner) WithPorts(ports ...int) *ContainerRunner
- type ContainerRunnerInterface
- type ContainerRunnerOpts
Constants ¶
const (
DefaultHostAddress = "127.0.0.1"
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ContainerRunner ¶
type ContainerRunner struct {
// contains filtered or unexported fields
}
ContainerRunner implements ContainerRunnerInterface and can construct a custom container with image and port options
func NewContainerRunner ¶
func NewContainerRunner() *ContainerRunner
NewContainerRunner builds a runner that can be used to start and stop containers using the locally installed docker engine
func (*ContainerRunner) Start ¶
func (e *ContainerRunner) Start(ctx context.Context) error
Start starts the container with the provided options
func (*ContainerRunner) Stop ¶
func (e *ContainerRunner) Stop(ctx context.Context) error
Stop stops the container that was started using Start
func (*ContainerRunner) WithEnvironmentVariable ¶
func (r *ContainerRunner) WithEnvironmentVariable(key, val string) *ContainerRunner
func (*ContainerRunner) WithImage ¶
func (r *ContainerRunner) WithImage(image string) *ContainerRunner
WithImage sets the container image that should be used. It defaults to the docker registry.
func (*ContainerRunner) WithName ¶
func (r *ContainerRunner) WithName(name string) *ContainerRunner
WithName sets the name of the container. Note that running Start with a container name that already exists will cause Start to fail.
func (*ContainerRunner) WithOptions ¶
func (r *ContainerRunner) WithOptions(opts *ContainerRunnerOpts) *ContainerRunner
WithOptions sets the options that the runner should run with=
func (*ContainerRunner) WithPorts ¶
func (r *ContainerRunner) WithPorts(ports ...int) *ContainerRunner
WithPorts sets the ports that should be exposed and forwarded from the container
type ContainerRunnerInterface ¶
type ContainerRunnerInterface interface { Start(context.Context) error Stop(context.Context) error }
ContainerRunnerInterface describes something that can start and stop containers
type ContainerRunnerOpts ¶
type ContainerRunnerOpts struct { // If RemoveOnFinalization is enabled, the container will be removed // after it is stopped. RemoveOnFinalization bool }
ContainerRunnerOpts allows customization of the runner's behavior