Connect app container to postgresql container on VPS


I need some help to wrap my head around docker containers deployed on VPS (Digital Ocean).

I have an image locally that spins as expected with docker-compose up with two containers: one for the app and one for the db.

When I push it to docker hub and deploy it to the VPS there is no postgres service on it. What I understand is that you make the image and then you can run it everywhere just by spinning the image regardless of the platform. Doesn’t seems so to me as of this moment.

I am using an e-commerce django app and it is fetching most of it’s configuration from environment variables.

So I have to configure DATABASE_URL variable in order to connect to the database once deployed.

I have installed postgresql on the VPS and it is running.

How can I get the url of the database when it is running in order to connect it to the app?

Do I need to create a container for the database?

postgres is running on port 5432 on the VPS.

Hope my question is not too vague!