I have an app (Flask/Pony ORM) container that must register the host for a postgres db container on start up. How can I get the host's (postgres container) location?
On my local set up I have "localhost" but this does not work in the app container.
I tried "172.17.0.2" which was what the pg containers IP when I was not using docker-compose.
But both of these return an error.
Is there a way to specify a host location for a particular container in the docker-compose file?
You must link your two containers in your docker-compose file. Then you will be able to access to your database using the service name of the container.
Example
links:
- postgres:postgres
Link your docker-compose.yml
if you need more help.