container

package
v0.434.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

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) 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

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

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

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