Documentation
¶
Index ¶
- Variables
- func DockerIP() (string, error)
- func NewHostConfig(pb *PortBindings) (*dockerContainer.HostConfig, error)
- func OneToOneRandomPort(proto Protocol, srcPort uint16) (string, uint16, []string, error)
- func RandomPort(proto Protocol, dstPort uint16) (string, uint16, []string, error)
- type Application
- type Binding
- type Container
- type ContainerID
- type ContainerInfo
- type Environment
- func (e Environment) BoolVar(name string, value bool) Environment
- func (e Environment) Eval(c ContainerInfo) (es []string)
- func (e Environment) Int16Var(name string, value int16) Environment
- func (e Environment) Int32Var(name string, value int32) Environment
- func (e Environment) Int64Var(name string, value int64) Environment
- func (e Environment) Int8Var(name string, value int8) Environment
- func (e Environment) IntVar(name string, value int) Environment
- func (e Environment) LogLevelVar(name string, l log.Level) Environment
- func (e Environment) StringVar(name, value string) Environment
- func (e Environment) Uint16Var(name string, value uint16) Environment
- func (e Environment) Uint32Var(name string, value uint32) Environment
- func (e Environment) Uint64Var(name string, value uint64) Environment
- func (e Environment) Uint8Var(name string, value uint8) Environment
- func (e Environment) UintVar(name string, value uint) Environment
- func (e Environment) Var(name string, vfn func(c ContainerInfo) string) Environment
- type Group
- type Hook
- type HookType
- type HostConfigSpec
- type HostPort
- type Matcher
- type NetworkID
- type PortAllocator
- type PortBindings
- type Protocol
Constants ¶
This section is empty.
Variables ¶
var ( ErrPortNotMapped = errors.New("port not mapped") ErrDockerHostIPIsNotResolved = errors.New("docker host IP address cannot be resolved") )
Functions ¶
func NewHostConfig ¶
func NewHostConfig(pb *PortBindings) (*dockerContainer.HostConfig, error)
NewHostConfig creates new HostConfig instance
func OneToOneRandomPort ¶ added in v1.1.0
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶
func NewApplication(c Container, hooks ...Hook) *Application
type Container ¶
type Container interface { AwaitOutput(ctx context.Context, m Matcher) error Close(ctx context.Context) error Name() string NetworkAttach(networkID string) error Ping(ctx context.Context) error Run(ctx context.Context) error URL(proto Protocol, port uint16) (*HostPort, error) }
Container exposes interface to control the container runtime
func NewContainer ¶
func NewContainer(name, image string, cmd []string, environment Environment, ports *PortBindings) (Container, error)
New creates new container instance from remote docker image
func NewContainerWithClient ¶
func NewContainerWithClient(cli *client.Client, name, image string, cmd []string, env Environment, ports *PortBindings) (Container, error)
NewContainerWithClient creates new container from remote docker image and allows to pass custom docker.Client instance
type ContainerID ¶
type ContainerID = string
type ContainerInfo ¶ added in v1.1.0
type Environment ¶
type Environment map[string]func(c ContainerInfo) string
Environment represents the container environment passed into runtime
func NewEnvironment ¶
func NewEnvironment() Environment
NewEnvironment creates new Environment instance
func (Environment) BoolVar ¶
func (e Environment) BoolVar(name string, value bool) Environment
BoolVar sets bool var to the environment
func (Environment) Eval ¶ added in v1.1.0
func (e Environment) Eval(c ContainerInfo) (es []string)
func (Environment) Int16Var ¶
func (e Environment) Int16Var(name string, value int16) Environment
Int16Var sets int16 var to the environment
func (Environment) Int32Var ¶
func (e Environment) Int32Var(name string, value int32) Environment
Int32Var sets int32 var to the environment
func (Environment) Int64Var ¶
func (e Environment) Int64Var(name string, value int64) Environment
Int64Var sets int64 var to the environment
func (Environment) Int8Var ¶
func (e Environment) Int8Var(name string, value int8) Environment
Int8Var sets int8 var to the environment
func (Environment) IntVar ¶
func (e Environment) IntVar(name string, value int) Environment
IntVar sets int var to the environment
func (Environment) LogLevelVar ¶
func (e Environment) LogLevelVar(name string, l log.Level) Environment
LogLevelVar sets logrus.Level var to the environment
func (Environment) StringVar ¶
func (e Environment) StringVar(name, value string) Environment
StringVar sets string var to the environment
func (Environment) Uint16Var ¶
func (e Environment) Uint16Var(name string, value uint16) Environment
Uint16Var sets uint16 var to the environment
func (Environment) Uint32Var ¶
func (e Environment) Uint32Var(name string, value uint32) Environment
Uint32Var sets uint32 var to the environment
func (Environment) Uint64Var ¶
func (e Environment) Uint64Var(name string, value uint64) Environment
Uint64Var sets uint64 var to the environment
func (Environment) Uint8Var ¶
func (e Environment) Uint8Var(name string, value uint8) Environment
Uint8Var sets uint8 var to the environment
func (Environment) UintVar ¶
func (e Environment) UintVar(name string, value uint) Environment
UintVar sets uint var to the environment
func (Environment) Var ¶ added in v1.1.0
func (e Environment) Var(name string, vfn func(c ContainerInfo) string) Environment
Var allows to set custom function to generate environment variable
type Group ¶
func NewGroupWithClient ¶
type HostConfigSpec ¶
HostConfigSpec is just a wrapper structure to pass host configuration to the container
type Matcher ¶
Matcher allows to create any kind of matcher for container outputs
func NewExactMatcher ¶
NewExactMatcher represents exact matcher i.e. the output should be exactly matched (except space chars around the word)
func NewRegexpMatcher ¶
func NewSubstringMatcher ¶
NewSubstringMatcher represents partial matcher
type PortAllocator ¶ added in v1.1.0
type PortBindings ¶
type PortBindings struct {
// contains filtered or unexported fields
}
PortBindings is a full mapping of internal & external docker container ports
func NewDirectPortBinding ¶ added in v1.1.0
func NewDirectPortBinding() *PortBindings
func NewPortBindings ¶
func NewPortBindings() *PortBindings
NewPortBindings creates new PortBindings instance
func NewPortBindingsWithPortAllocator ¶ added in v1.1.0
func NewPortBindingsWithPortAllocator(allocator PortAllocator) *PortBindings
NewPortBindingsWithTCPPortAllocator creates new PortBinding instance and allows to pass custom port allocation function
func (*PortBindings) PortDNAT ¶
func (pb *PortBindings) PortDNAT(proto Protocol, port uint16) *PortBindings
PortDNAT adds new port to be exposed from the container