Container

data class Container(val createCmd: CreateContainerCmd.() -> Unit, val beforeStartHook: (docker: DockerClient, id: String) -> Unit)

A Container creates a Docker container for testing.

Tests provide a lambda to build a CreateContainerCmd. The createCmd lambda must set CreateContainerCmd.withName and CreateContainerCmd.withImage. All other fields are optional. The Composer takes care of setting up the network.

There may be a need to configure your container between the creation and start steps. beforeStartHook provides you with an id to your container allowing you to manipulate as necessary before the command/entrypoint is invoked.

See Composer for an example.

Constructors

Link copied to clipboard
constructor(createCmd: CreateContainerCmd.() -> Unit)
constructor(createCmd: CreateContainerCmd.() -> Unit, beforeStartHook: (docker: DockerClient, id: String) -> Unit)

Properties

Link copied to clipboard
val beforeStartHook: (docker: DockerClient, id: String) -> Unit
Link copied to clipboard
val createCmd: CreateContainerCmd.() -> Unit