Skip to content

Fix PostgreSQL not listening on the internal network - #54

Open
xrhstosmour wants to merge 1 commit into
mainfrom
fix/postgresql-listen-address
Open

Fix PostgreSQL not listening on the internal network#54
xrhstosmour wants to merge 1 commit into
mainfrom
fix/postgresql-listen-address

Conversation

@xrhstosmour

Copy link
Copy Markdown
Owner

What:

  1. Sets listen_addresses = '*' in databases/postgresql/configuration/postgresql.conf. Without it, Postgres only binds to localhost inside its own container and refuses connections from any other container on the shared internal network, including its existing consumers in separate compose projects (GlitchTip, Metabase, pgAdmin4).
  2. To keep this from expanding exposure, also restricts the published host port to 127.0.0.1 in docker-compose.yml, the same restriction already applied to pgAdmin4/Metabase/Redis Commander/Mailpit. Other containers reach Postgres over the internal Docker network directly, never through the published host port, so this only affects local/tunnelled admin access, not container-to-container connectivity.

Why:

Found while wiring Authelia to the shared postgresql container in #52: a plain nc from an unrelated container on the internal network got connection refused, confirmed to be listen_addresses defaulting to localhost rather than a credentials or networking issue.

Testing:

  1. docker compose config validates with no errors, docker port confirms the host binding is 127.0.0.1:5432, not 0.0.0.0:5432.
  2. SHOW listen_addresses; returns * after the fix.
  3. Confirmed both paths work: nc from the host to 127.0.0.1:5432 succeeds, and nc from an unrelated container on the internal network to postgresql:5432 also succeeds.
  4. docker compose down -v cleans up with no leftover state.

@xrhstosmour xrhstosmour added the bug Something isn't working label Aug 6, 2026
@xrhstosmour xrhstosmour self-assigned this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant