container

package
v0.411.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeUp added in v0.407.0

func ComposeUp(ctx context.Context, name, composeYAML string, envars ...string) 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.

func DoesExist

func DoesExist(ctx context.Context, name string, image optional.Option[string]) (bool, error)

func Exec

func Exec(ctx context.Context, name string, command ...string) error

Exec runs a command in the given container, stream to stderr. Return an error if the command fails.

func GetContainerPort

func GetContainerPort(ctx context.Context, name string, port int) (int, error)

GetContainerPort returns the host TCP port of the given container's exposed port.

func PollContainerHealth

func PollContainerHealth(ctx context.Context, containerName string, timeout time.Duration) error

PollContainerHealth polls the given container until it is healthy or the timeout is reached.

func Pull added in v0.217.5

func Pull(ctx context.Context, imageName string) error

Pull pulls the given image.

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 added in v0.398.0

func RunMySQL(ctx context.Context, name string, port int, image string) error

RunMySQL runs a new detached postgres container with the given name and exposed port.

func RunPostgres added in v0.398.0

func RunPostgres(ctx context.Context, name string, port int, image string) error

RunPostgres runs a new detached postgres container with the given name and exposed port.

func Start

func Start(ctx context.Context, name string) error

Start starts an existing container with the given name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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