testcontainers-go Documentation

Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests.

RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy testcontainers-go on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name testcontainers-go --restart always testcontainers/testcontainers-go:latest
docker-compose.yml
yaml (docker-compose.yml)
services:
  {{ .ServiceType }}-echo:
    build:
      dockerfile: echoserver.Dockerfile
    environment:
      FOO: "Hello, World!"
    ports:
      - target: 8080
        published: {{ .Port_0 }}
        protocol: tcp

File: docs/index.md

Welcome to Testcontainers for Go!

text
[Java](https://java.testcontainers.org)
<a class="card-grid-item">Go</a>
[.NET](https://dotnet.testcontainers.org/)
[Node.js](https://node.testcontainers.org/)
[Python](https://testcontainers-python.readthedocs.io/en/latest/)
[Rust](https://rust.testcontainers.org/)
[Ruby](https://github.com/testcontainers/testcontainers-ruby/)
[PHP](https://php.testcontainers.org/)
[Haskell](https://github.com/testcontainers/testcontainers-hs/)
[Clojure](https://cljdoc.org/d/clj-test-containers/clj-test-containers/)
[Elixir](https://github.com/testcontainers/testcontainers-elixir)
[Scala](https://github.com/testcontainers/testcontainers-scala/)
[Native](https://github.com/testcontainers/testcontainers-native)

About Testcontainers for Go

Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for
automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers
that should be run as part of a test and clean up those resources when the test is done.

To start using Testcontainers for Go please read our quickstart guide.

GoDoc

Inline documentation and docs where the code live is crucial for us. Go has nice support for them and we provide
examples as well. Check it out at
pkg.go.dev/github.com/testcontainers/testcontainers-go.

Who is using Testcontainers Go?

  • Elastic - Testing of the APM Server, and E2E testing for Beats
  • Telegraf - Integration testing the plugin-driven server agent for collecting & reporting metrics
  • Intel - Reference implementation design E2E testing for microservice-based solutions
  • OpenTelemetry - Integration testing of the OpenTelemetry Collector receivers

License

This project is opensource and you can have a look at the code on
GitHub. See LICENSE.

Copyright (c) 2018-present Gianluca Arbezzano and other authors. Check out our
lovely contributors.