I am developing the Heroku toy app and want to use the PostgreSQL database to store configurations. I either see tutorials on how to use Java + PostgreSQL or Java on Docker.

I cannot find a way on how I can use Java in Docker + PostgreSQL.

NOTE: Database is a rather unimportant piece. It can be anything that can persist info such as Redis, other databases.

I looked through StackOverflow, tutorials, and Heroku doc but so far, no luck.

How can I connect to PostgreSQL from Java in Docker on Heroku?