Configure PostgreSQL to accept connections from any IP address
This commit is contained in:
parent
b77b6689f0
commit
1c6883107b
15
Dockerfile
15
Dockerfile
|
|
@ -6,5 +6,16 @@ COPY backup_global_20260130_184353.sql /tmp/restore.sql
|
||||||
# Set correct permissions
|
# Set correct permissions
|
||||||
RUN chmod 644 /tmp/restore.sql
|
RUN chmod 644 /tmp/restore.sql
|
||||||
|
|
||||||
# Configure pg_hba.conf to accept connections from any host
|
# Create custom pg_hba.conf to allow connections from anywhere
|
||||||
RUN echo "host all all 0.0.0.0/0 scram-sha-256" >> /usr/local/share/postgresql/pg_hba.conf.sample
|
RUN echo "# Allow connections from any IP address" > /tmp/pg_hba_additions.conf && \
|
||||||
|
echo "host all all 0.0.0.0/0 scram-sha-256" >> /tmp/pg_hba_additions.conf && \
|
||||||
|
echo "host all all ::/0 scram-sha-256" >> /tmp/pg_hba_additions.conf
|
||||||
|
|
||||||
|
# Copy script to append to pg_hba.conf on startup
|
||||||
|
COPY <<EOF /docker-entrypoint-initdb.d/00-allow-remote.sh
|
||||||
|
#!/bin/bash
|
||||||
|
echo "host all all 0.0.0.0/0 scram-sha-256" >> /var/lib/postgresql/data/pg_hba.conf
|
||||||
|
echo "host all all ::/0 scram-sha-256" >> /var/lib/postgresql/data/pg_hba.conf
|
||||||
|
EOF
|
||||||
|
|
||||||
|
RUN chmod +x /docker-entrypoint-initdb.d/00-allow-remote.sh
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue