Skip to content

POSTGRES_DB environment variable not honored during initialization #29

@adityathebe

Description

@adityathebe

Problem

The flanksource/postgres:17 image does not create the database specified in the POSTGRES_DB environment variable during initialization, unlike standard PostgreSQL images (including supabase/postgres).

Expected Behavior

When POSTGRES_DB is set to a value other than "postgres", that database should exist after the container starts for the first time.

Current Behavior

Only the default databases are created:

  • postgres
  • template0
  • template1

The custom database specified in POSTGRES_DB is not created.

Reproduction

# docker-compose.yaml
services:
  postgres:
    image: ghcr.io/flanksource/postgres:17
    environment:
      POSTGRES_DB: mission_control
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: testpassword
    ports:
      - "5432:5432"

Running docker-compose up and then checking with psql -U postgres -c "\l" shows that mission_control database does not exist.

Impact

This breaks migration from supabase/postgres to flanksource/postgres when using helm charts that rely on POSTGRES_DB to automatically create the application database.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions