Registry /
testing / testcontainers-testcontainer-go
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
testcontainer
✓ github.com/testcontainers/testcontainer-go
Starts a Redis container for testing
package main
import (
"context"
"fmt"
"github.com/testcontainers/testcontainer-go"
"github.com/testcontainers/testcontainer-go/wait"
)
func main() {
ctx := context.Background()
req := testcontainer.ContainerRequest{
Image: "redis:latest",
ExposedPorts: []string{"6379/tcp"},
WaitingFor: wait.ForLog("Ready to accept connections"),
}
redisC, _ := testcontainer.GenericContainer(ctx, testcontainer.GenericContainerRequest{
ContainerRequest: req,
Started: true,
})
defer redisC.Terminate(ctx)
fmt.Println("Redis container started")
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.42.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.