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

2024-12-02 Thread Jeremy Smith
> > > Is anybody able spotting, what am I doing wrong here? Thank you > Unless I'm mistaken, it seems like you are trying to run jetty and postgres in the same container. You should really use two containers and run them both with docker compose. Docker is very much designed to run a single ser

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

2024-12-02 Thread Alexander Farber
Thank you Torsten, On Mon, Dec 2, 2024 at 12:32 PM Torsten Krah wrote: > Am Sonntag, dem 01.12.2024 um 21:59 +0100 schrieb Alexander Farber: > > But I am yet not sure how to enable listening at localhost again > > Instead of using a TCP/IP connection, why not use the unix socket to > connect to

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

2024-12-02 Thread Torsten Krah
Am Sonntag, dem 01.12.2024 um 21:59 +0100 schrieb Alexander Farber: > But I am yet not sure how to enable listening at localhost again Instead of using a TCP/IP connection, why not use the unix socket to connect to your database [1]? [1] https://jdbc.postgresql.org/documentation/use/#unix-sockets

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

2024-12-02 Thread Alexander Farber
Hi again, I would like to share a slightly better workaround (does not restart PostgreSQL) for enabling localhost connections (for example for servlets) in a postgres:17-alpine3.20 based Dockerfile: RUN sed -i "s/listen_addresses=''/listen_addresses='localhost'/" /usr/local/bin/docker-entrypoint.s

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

2024-12-01 Thread Alexander Farber
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=

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

2024-12-01 Thread Peter Kleiner
Seems too easy but have you tried psql -p 6432 -h localhost words_de ? On Sun, Dec 1, 2024 at 3:59 PM Alexander Farber wrote: > My problem is related to > https://github.com/docker-library/postgres/pull/440/files > > But I am yet not sure how to enable listening at localhost again >

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

2024-12-01 Thread Adrian Klaver
On 12/1/24 11:34, Alexander Farber wrote: Good evening, I am trying to create a Dockerfile for development purposes, which would run Jetty and PostgreSQL. The PostgreSQL related part is below: When I connect to the docker container via terminal, I am able to connect with "psql words_de" comm

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

2024-12-01 Thread Tom Lane
Alexander Farber writes: > it is empty in my docker container (but "localhost" on my prod server), > so I probably need to investigate that... I'm betting the postgresql.conf entry is being overridden with a postmaster command-line switch (not an initdb switch, which merely sets up a postgresql.c

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

2024-12-01 Thread Alexander Farber
My problem is related to https://github.com/docker-library/postgres/pull/440/files But I am yet not sure how to enable listening at localhost again

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

2024-12-01 Thread Alexander Farber
I have tried changing the line in the Dockerfile, but it has not helped yet: ENV POSTGRES_INITDB_ARGS "--set port=6432 --set max_connections=20 --set max_wal_size=2GB --set listen_addresses=localhost" ENV POSTGRES_INITDB_ARGS "--set port=6432 --set max_connections=20 --set max_wal_size=2GB --set

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

2024-12-01 Thread Alexander Farber
Thank you, Tom - On Sun, Dec 1, 2024 at 8:58 PM Tom Lane wrote: > Alexander Farber writes: > > TLDR "psql words_de" works, but "psql -h localhost words_de" does not > > I'd try connecting the first way and seeing what "show > listen_addresses" gives. Per your report it should be "*", > but may

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

2024-12-01 Thread Tom Lane
Alexander Farber writes: > TLDR "psql words_de" works, but "psql -h localhost words_de" does not I'd try connecting the first way and seeing what "show listen_addresses" gives. Per your report it should be "*", but maybe something is overriding that. If it is "*", then it seems like something i

Connection to 127.0.0.1 refused in a Dockerfile based on postgres:17-alpine3.20

2024-12-01 Thread Alexander Farber
Good evening, I am trying to create a Dockerfile for development purposes, which would run Jetty and PostgreSQL. The PostgreSQL related part is below: FROM postgres:17-alpine3.20 RUN apk update && apk upgrade && apk add --no-cache curl wget openjdk21 tini # Tell docker-entrypoint.sh to create su