I have created a nodeJs app container. The node app works fine, but I have difficulties in connecting it with the database that runs on host machine. This is my docker-compose configurations.
version: "3.0"
services:
web:
image: hello-world
environment:
DB_USER: someusername
DB_PASSWORD: somepassword
DB_HOST: 127.0.0.1
DB_NAME: somedatabasename
Upon Running docker-compose up. The node app runs successfully, but whenever some database specific thing is performed, it returns with Econ refused error. I think that's because the docker looks at that DB_HOST and accesses the service from within container. What should I do with the DB_HOST so that my node app can access the db from outside the container?