Documentation
¶
Index ¶
- func ComposeUp(ctx context.Context, name, composeYAML string, profile optional.Option[string], ...) (down func() error, err error)
- func DoesExist(ctx context.Context, name string, image optional.Option[string]) (bool, error)
- func Exec(ctx context.Context, name string, command ...string) error
- func GetContainerPort(ctx context.Context, name string, port int) (int, error)
- func PollContainerHealth(ctx context.Context, containerName string, timeout time.Duration) error
- func Pull(ctx context.Context, imageName string) error
- func Run(ctx context.Context, image, name string, hostToContainerPort map[int]int, ...) error
- func RunMySQL(ctx context.Context, name string, port int, image string) error
- func RunPostgres(ctx context.Context, name string, port int, image string) error
- func Start(ctx context.Context, name string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComposeUp ¶
func ComposeUp(ctx context.Context, name, composeYAML string, profile optional.Option[string], envars ...string) (down func() error, err error)
ComposeUp runs docker-compose up with the given compose YAML.
Make sure you obtain the compose yaml from a string literal or an embedded file, rather than reading from disk. The project file will not be included in the release build.
The "down" function can be optionally called to stop the containers.
func Exec ¶
Exec runs a command in the given container, stream to stderr. Return an error if the command fails.
func GetContainerPort ¶
GetContainerPort returns the host TCP port of the given container's exposed port.
func PollContainerHealth ¶
PollContainerHealth polls the given container until it is healthy or the timeout is reached.
func Run ¶
func Run(ctx context.Context, image, name string, hostToContainerPort map[int]int, volume optional.Option[string], env ...string) error
Run starts a new detached container with the given image, name, port map, and (optional) volume mount.
func RunMySQL ¶
RunMySQL runs a new detached postgres container with the given name and exposed port.
func RunPostgres ¶
RunPostgres runs a new detached postgres container with the given name and exposed port.
Types ¶
This section is empty.