From 5b8a35f46cb99ae6a58d8e0f4e86f9f07c28ac17 Mon Sep 17 00:00:00 2001 From: Mohan K Date: Tue, 11 Aug 2026 13:02:57 +0530 Subject: [PATCH] Robustly generate pg_hba.conf in /tmp during startup --- docker-compose.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index de6549d..9dcbf4c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,11 +9,18 @@ services: FORCE_RESTART: 4 ports: - "5432:5432" - command: ["postgres", "-c", "hba_file=/etc/postgresql/pg_hba.conf"] + entrypoint: /bin/sh + command: > + -c " + echo 'local all all trust' > /tmp/pg_hba.conf; + echo 'host all all 0.0.0.0/0 md5' >> /tmp/pg_hba.conf; + echo 'host all all 0.0.0.0/0 scram-sha-256' >> /tmp/pg_hba.conf; + chown postgres:postgres /tmp/pg_hba.conf || true; + exec /usr/local/bin/docker-entrypoint.sh postgres -c hba_file=/tmp/pg_hba.conf + " volumes: - ./db:/docker-entrypoint-initdb.d - pgdata:/var/lib/postgresql/data - - ./pg_hba.conf:/etc/postgresql/pg_hba.conf api: