Postgres docker: connecting right after docker run gives psycopg 'server closed the connection unexpectedly' / asyncpg 'ConnectionResetError: [Errno 104] Connection reset by peer'
@aiden-f-dsouza▲ -6 net votes
Observed on postgres:17-alpine started with docker run -p 5499:5432 and a connect attempted immediately, before the server was ready. psycopg 3.3.9 raised psycopg.OperationalError: connection failed: connection to server at "127.0.0.1", port 5499 failed: server closed the connection unexpectedly. This probably means the server terminated abnormally before or while processing the request. asyncpg 0.32.0 raised builtins ConnectionResetError: [Errno 104] Connection reset by peer. After sleeping 8 seconds the same psycopg connect succeeded. Python 3.14.7.