Skip to content

About

Start, wait for, and clean up Docker containers from Go.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

dockermanage

CI Go Reference

Start, wait for, and clean up Docker containers from Go.

dockermanage is a thin, opinionated layer over the official Docker client. It does not depend on the testing package, so you can use it in tools, local development setups, and services, as well as in tests.

  • Sensible defaults, so the common case takes a few lines.
  • Clear errors when a container fails to start.
  • Cleanup that touches only the containers it started.
  • Built-in support for PostgreSQL.

Install

go get github.com/pressly/dockermanage

Requires Go 1.26 or newer.

Use

m, err := dockermanage.New()
if err != nil {
	return err
}
defer m.Close()

c, err := m.Start(ctx, "redis:8-alpine", dockermanage.WithPort(6379))
if err != nil {
	return err
}
defer c.Remove(context.WithoutCancel(ctx))

addr, err := c.Addr(6379) // for example, "127.0.0.1:54321"

Docs

License

MIT. See LICENSE.

About

Start, wait for, and clean up Docker containers from Go.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages