I'm trying to run a docker container by following the multi stage build process here https://backstage.io/docs/deployment/docker/
I already have a postgres instance running and the application connects successfully when using yarn dev . However, I get this error when running the docker container: Error: Failed to connect to the database to make sure that 'backstage_plugin_app' exists, Error: connect ECONNREFUSED 127.0.0.1:5432
Here is what I have in both app-config.yml and app-config.production.yml
client: pg
connection:
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
ssl:
require: true
rejectUnauthorized: true
And I'm attaching my Dockerfile at the bottom
The host shouldn't be localhost, it should be what I've specified in POSTGRES_HOST. I think that is the issue but I don't know how to make the docker container point to the right host. Any ideas on how to fix this?