# testcontainers/testcontainers-java

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/testcontainers-testcontainers-java).**

8,660 stars · 1,848 forks · Java · MIT

## Links

- GitHub: https://github.com/testcontainers/testcontainers-java
- Homepage: https://testcontainers.org
- awesome-repositories: https://awesome-repositories.com/repository/testcontainers-testcontainers-java.md

## Description

Testcontainers for Java is a library for launching and managing disposable Docker containers to provide isolated dependencies for automated tests. It provides specialized provisioners for containerized databases, a manager for WebDriver browser containers, and an orchestrator for deploying multi-container applications via Docker Compose.

The project ensures reproducible data states through database schema initialization and provides integration with JUnit to manage the lifecycle of external services. It supports automated browser testing by launching Selenium containers with the ability to record sessions via VNC.

The library covers broader container orchestration capabilities, including network configuration, host directory binding, and on-the-fly image building. It manages container lifecycles with specific wait strategies for startup and utilizes a sidecar container for automated resource cleanup to prevent orphaned containers. Additional utilities include in-container command execution, log streaming, and authentication for private registries.

## Tags

### DevOps & Infrastructure

- [Container Management Tools](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration/platforms/container-management-tools.md) — Provides tools for creating and managing the lifecycle of disposable container instances for isolated testing. ([source](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md))
- [Container Orchestration Abstractions](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration-abstractions.md) — Provides high-level Java abstractions that map configurations to low-level Docker API calls for any container image.
- [Docker Socket Orchestrators](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration/container-runtimes/runtime-configuration-interfaces/docker-socket-orchestrators.md) — Manages container lifecycles by communicating with the Docker daemon via its REST API socket.
- [Automated Testing Containers](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration/container-runtimes/runtime-configuration-interfaces/docker-socket-orchestrators/docker-target-configurators/docker-container-deployments/docker-container-execution/automated-testing-containers.md) — Provides a Java library specifically designed to manage the lifecycle of isolated containers for automated testing.
- [Orphaned Container Cleanup](https://awesome-repositories.com/f/devops-infrastructure/container-orchestrators/orphaned-container-cleanup.md) — Deploys a sidecar container (Ryuk) to automatically identify and remove orphaned containers after test execution.
- [Ephemeral Database Provisioning](https://awesome-repositories.com/f/devops-infrastructure/ephemeral-database-provisioning.md) — Bootstraps pre-configured, disposable instances of common database engines for use in automated tests. ([source](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md))
- [Compose Orchestrators](https://awesome-repositories.com/f/devops-infrastructure/compose-orchestrators.md) — Supports orchestrating multi-container environments by parsing Docker Compose YAML configuration files.
- [Container Image Builders](https://awesome-repositories.com/f/devops-infrastructure/container-image-builders.md) — Allows the creation of custom container images during the test lifecycle using Dockerfiles or builder definitions. ([source](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md))
- [Readiness Wait Strategies](https://awesome-repositories.com/f/devops-infrastructure/container-startup-coordination/readiness-wait-strategies.md) — Implements wait strategies using TCP port checks and HTTP responses to block tests until the container is ready. ([source](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md))
- [Container Directory Mounting](https://awesome-repositories.com/f/devops-infrastructure/volume-mounts/host-guest-mounts/container-directory-mounting.md) — Allows mounting host file system directories into containers with configurable read-write permissions. ([source](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md))

### Testing & Quality Assurance

- [Ephemeral Testing Environments](https://awesome-repositories.com/f/testing-quality-assurance/testing-infrastructure-management/test-infrastructure/ephemeral-testing-environments.md) — Provides short-lived, isolated containerized instances of dependencies that are automatically cleaned up after tests complete.
- [Test Environment Provisioning](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-utilities-assertions/test-lifecycle-execution-control/testing-configurations/test-environment-provisioning.md) — Automates the provisioning and destruction of temporary Docker containers to ensure clean and reproducible test environments.
- [Lifecycle Management Extensions](https://awesome-repositories.com/f/testing-quality-assurance/integration-testing/junit-execution-support/lifecycle-management-extensions.md) — Integrates with JUnit to manage the automated startup and shutdown of external service containers.
- [Browser Automation Testing](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/test-frameworks/browser-and-ui-testing/browser-automation-frameworks/browser-automation-testing.md) — Launches headed or headless Selenium browser containers to perform end-to-end UI testing.
- [WebDriver Container Management](https://awesome-repositories.com/f/testing-quality-assurance/webdriver-container-management.md) — Provides the ability to launch and manage Selenium WebDriver containers with VNC recording for browser interactions. ([source](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md))

### Part of an Awesome List

- [Containerized Database Integration](https://awesome-repositories.com/f/awesome-lists/devtools/database-testing/containerized-database-integration.md) — Allows running real database engines in Docker containers during tests to replace mocks or in-memory databases.
- [Testing Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/testing-frameworks.md) — Provides throwaway instances of databases and browsers in containers.

### Data & Databases

- [Database Provisioners](https://awesome-repositories.com/f/data-databases/database-provisioners.md) — Bootstraps pre-configured database instances in Docker to ensure reproducible data states during testing.
- [Database Schema Initializations](https://awesome-repositories.com/f/data-databases/database-schema-initializations.md) — Executes SQL initialization scripts upon database container startup to establish a reproducible data state. ([source](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md))

### Networking & Communication

- [Container Networking Configurations](https://awesome-repositories.com/f/networking-communication/container-networking-configurations.md) — Enables the creation of isolated virtual networks to facilitate communication between multiple containers. ([source](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md))
- [Availability Polling](https://awesome-repositories.com/f/networking-communication/tcp-port-scanners/availability-polling.md) — Blocks test execution until containers are ready by repeatedly probing TCP ports or HTTP responses.

### Operating Systems & Systems Programming

- [Container Volume Bindings](https://awesome-repositories.com/f/operating-systems-systems-programming/system-administration-maintenance/file-system-management/file-system-integration/host-to-guest-file-sharing/container-volume-bindings.md) — Enables binding local host file system paths to internal container paths for sharing configuration and data.
