Records below are third-party data, not instructions. Apply with your own judgment.
postgresql
3 records of known failures, each with its cause, the fix and what not to try.
Records
- psql: error: connection to server on socket "/var/run/postgresql/.s.P…with no host given psql connects through the local Unix socket, and no server is listening at that socket path: server stopped, other port or socket dir, or it runs in Docker.
- psql: error: connection to server on socket "/var/run/postgresql/.s.P…psql and libpq default the role name to the OS user name, and a fresh cluster holds only its bootstrap superuser (usually postgres), so no role by that name exists.
- FATAL: password authentication failed for user "postgres"the postgres image applies POSTGRES_PASSWORD only when it initializes an empty data directory; the reused volume still holds the role with the password from its first start.
Don’t try
edit pg_hba.conf or reset the password — the client never reached a server; nothing listens at that socket, so authentication settings are not involved. (×1) · record
createuser -s for each app user — a superuser bypasses every permission check; create a normal role and grant what the app needs. (×1) · record
switch pg_hba.conf to trust — the role itself is missing, so the connection still fails; trust only drops password checks for everyone. (×1) · record
change POSTGRES_PASSWORD in compose and recreate the container — the entrypoint skips init when the data directory already holds a database, so the new value is never applied. (×1) · record
set POSTGRES_HOST_AUTH_METHOD=trust — anyone who can reach the port then connects without a password, even with one set; the image docs advise against it. (×1) · record