I am using custom docker container to build code, the container is integrated with Amazon codebuild. AWS codebuild spins up a Docker container and builds the code on the container provided by us. The Dockerfile of container that I've written is like this -> Dockerfile
The Docker container is supposed to have Java-8, Gradle-4.7 and Postgres-10 installed on it.
I run the Docker container on the local machine and can see Postgres service running. However, on AWS codebuild, the docker container does not start the Postgres server. I tried to know the status of Postgres using commands in buildspec.yml file and found out it is down.
Following is the error I can see in the cloudwatch logs -
May 18, 2018 9:26:33 AM org.postgresql.Driver connect
SEVERE: Connection error:
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Does anyone have any idea about this? Is the Dockerfile correct?