diff --git a/docs/modules/postgres.md b/docs/modules/postgres.md index 47cb9115dc..683ed29162 100644 --- a/docs/modules/postgres.md +++ b/docs/modules/postgres.md @@ -41,7 +41,7 @@ When starting the Postgres container, you can pass options in a variadic way to #### Image If you need to set a different Postgres Docker image, you can use `testcontainers.WithImage` with a valid Docker image -for Postgres. E.g. `testcontainers.WithImage("docker.io/postgres:9.6")`. +for Postgres. E.g. `testcontainers.WithImage("docker.io/postgres:16-alpine")`. {% include "../features/common_functional_options.md" %} diff --git a/modules/postgres/examples_test.go b/modules/postgres/examples_test.go index ee164fdb6a..20fc50d696 100644 --- a/modules/postgres/examples_test.go +++ b/modules/postgres/examples_test.go @@ -21,7 +21,7 @@ func ExampleRunContainer() { dbPassword := "password" postgresContainer, err := postgres.RunContainer(ctx, - testcontainers.WithImage("docker.io/postgres:15.2-alpine"), + testcontainers.WithImage("docker.io/postgres:16-alpine"), postgres.WithInitScripts(filepath.Join("testdata", "init-user-db.sh")), postgres.WithConfigFile(filepath.Join("testdata", "my-postgres.conf")), postgres.WithDatabase(dbName), diff --git a/modules/postgres/postgres.go b/modules/postgres/postgres.go index cb3d01694b..cd349494c8 100644 --- a/modules/postgres/postgres.go +++ b/modules/postgres/postgres.go @@ -13,7 +13,7 @@ import ( const ( defaultUser = "postgres" defaultPassword = "postgres" - defaultPostgresImage = "docker.io/postgres:11-alpine" + defaultPostgresImage = "docker.io/postgres:16-alpine" defaultSnapshotName = "migrated_template" ) @@ -26,10 +26,9 @@ type PostgresContainer struct { snapshotName string } - // MustConnectionString panics if the address cannot be determined. func (c *PostgresContainer) MustConnectionString(ctx context.Context, args ...string) string { - addr, err := c.ConnectionString(ctx,args...) + addr, err := c.ConnectionString(ctx, args...) if err != nil { panic(err) }