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>testcontainers-postgresql</artifactId> <version>2.0.1</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(context.Background(), "postgres:16-alpine", postgres.WithDatabase("test"), postgres.WithUsername("user"), postgres.WithPassword("password"), ) Dependency:
dotnet add package Testcontainers.PostgreSql 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("postgres:13.3-alpine").start(); Dependency:
pip install testcontainers[postgres] Usage:
with PostgresContainer("postgres:16") as postgres: engine = sqlalchemy.create_engine(postgres.get_connection_url()) Dependency:
cargo add -F postgres --dev testcontainers-modules Usage:
testcontainers_modules::postgres::Postgres::default().start()