🚨 AtomicJar is now part of Docker 🐋! Read the blog

Description

PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.

Examples

Dependency:
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>postgresql</artifactId>
    <version>1.20.0</version>
    <scope>test</scope>
</dependency>
Usage:
var postgres = new PostgreSQLContainer<>(DockerImageName.parse("postgres:16-alpine"));
postgres.start();
Dependency:
go get github.com/testcontainers/testcontainers-go/modules/postgres
Usage:
postgresContainer, err := postgres.Run(ctx,
  "postgres:16-alpine",
  postgres.WithDatabase("test"),
  postgres.WithUsername("user"),
  postgres.WithPassword("password"),
)
Dependency:
dotnet add package Testcontainers.PostgreSql --version 3.9.0
Usage:
var postgreSqlContainer = new PostgreSqlBuilder()
  .WithImage("postgres:16")
  .Build();
await postgreSqlContainer.StartAsync();
Dependency:
npm install @testcontainers/postgresql --save-dev
Usage:
const container = await new PostgreSqlContainer().start();
Dependency:
pip install testcontainers[postgres]
Usage:
with PostgresContainer("postgres:16") as postgres:
    engine = sqlalchemy.create_engine(postgres.get_connection_url())