Docker container cannot read database hosted outside of the container

Hi there I have a local database that is hosted on 0.0.0.0:5432.
Is there any way that I can allow the container to read to the database outside of the of the container. Because I’m still facing this error.
django.db.utils.OperationalError: connection to server at “127.0.0.1”, port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?

127.0.0.1 is localhost within the container, not on the host. Usually the host has a real IP, which you can reach from within the container.

No, I can’t seems to reach the host IP address.
Is there any command I can proof it.

Run hostname -I on Linux host to see all used IP addresses.

What is the new error? And please show the output of the followin commands:

docker info
docker version

Use code blocks like this:


```
docker info
docker version
```

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.