Re: Connection to 127.0.0.1 refused in a Dockerfile based on postgres:17-alpine3.20 - Mailing list pgsql-general

From Alexander Farber
Subject Re: Connection to 127.0.0.1 refused in a Dockerfile based on postgres:17-alpine3.20
Date
Msg-id CAADeyWg4YwL=EH+ctP5r1frWBv+pEMwx8JwQdK+_VjLz=H9iOw@mail.gmail.com
Whole thread Raw
In response to Re: Connection to 127.0.0.1 refused in a Dockerfile based on postgres:17-alpine3.20  (Peter Kleiner <runtfan71@gmail.com>)
Responses Re: Connection to 127.0.0.1 refused in a Dockerfile based on postgres:17-alpine3.20
List pgsql-general
Yes thank you, I have tried specifying the port at the CLI too... that did not help.

But restarting PostgreSQL in my custom /docker-entrypoint-initdb.d/run-after-initdb.sh
has helped, even though I am not sure if it is the best way:

#!/bin/sh

LANGUAGES="de en fr nl pl ru"

createuser --username=postgres words

psql --username=postgres -c "GRANT USAGE ON SCHEMA public TO words;"
psql --username=postgres -c "ALTER USER words PASSWORD 'mypassword';"

for L in $LANGUAGES; do
    createdb --username=postgres --owner=words words_$L
    cd /dict/$L && psql words_$L < words_$L.sql
done

# Restart PostgreSQL to make it listen at localhost too
pg_ctl --options "-c listen_addresses='localhost'" --wait restart

pgsql-general by date:

Previous
From: Peter Kleiner
Date:
Subject: Re: Connection to 127.0.0.1 refused in a Dockerfile based on postgres:17-alpine3.20
Next
From: Adrian Klaver
Date:
Subject: Re: Errors when restoring backup created by pg_dumpall