Docker Community Forums

Share and learn in the Docker community.

Postgresql connection randomly refused

I got sometimes the message “connection to floris:5432 refused. check that the hostname and port are correct and that the postmaster is accepting tcp/ip connections.” when I try to connect to a PostgreSQL database. If the connection is refused it could take 20-30 minutes before it is accepted again, but the issue seems to get worse over time. The postgresql database is up and running. When I start a Bash session in the running Postgresql container, and within Bash start an interactive terminal using psql, the database is responding well. Any help is appreciated.

I am running Docker version 1.13.1, build 64e9980/1.13.1 on a Red Hat Enterprise Linux Server release 7.8 (Maipo). The running container is based upon the postgresql-10-rhel7 image from the RedHat repository. PostgreSQL version is 10.6