Override pg_hba.conf using a custom file

This commit is contained in:
2026-08-11 13:01:34 +05:30
parent 9aff075893
commit 02207d6b80
2 changed files with 8 additions and 9 deletions
+3 -9
View File
@@ -6,20 +6,14 @@ services:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
POSTGRES_DB: sop_monitoring
FORCE_RESTART: 3
FORCE_RESTART: 4
ports:
- "5432:5432"
command: ["postgres", "-c", "hba_file=/etc/postgresql/pg_hba.conf"]
volumes:
- ./db:/docker-entrypoint-initdb.d
- pgdata:/var/lib/postgresql/data
db_fixer:
image: alpine
restart: "no"
volumes:
- pgdata:/var/lib/postgresql/data
command: >
sh -c "find /var/lib/postgresql/data -name pg_hba.conf -exec sh -c 'echo \"local all all trust\" > \"$1\"; echo \"host all all 127.0.0.1/32 trust\" >> \"$1\"; echo \"host all all ::1/128 trust\" >> \"$1\"; echo \"host all all all md5\" >> \"$1\"; echo \"host all all all scram-sha-256\" >> \"$1\"' _ {} \;"
- ./pg_hba.conf:/etc/postgresql/pg_hba.conf
api: