Category: Installation


This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to connect to postgres instance on same docker host?


I am trying to add Postgres as a data source in Appsmith, which both run on the same Docker host. However, I keep getting refused to connect errors when using the server's public IP, Docker internal IP, and localhost in the host address field. I need to know what to use as the host address for my PG data source.


The issue is that the connection to the Postgres database is being refused when attempting to add it as a data source to Appsmith. The host address field in the data source configuration needs to be updated to "db". This is because the Postgres service is defined as "db" in the docker-compose.yml file.

Alternatively, when developing and testing, the host address can be set to "host.docker.internal" instead of localhost or an IP. However, this is not recommended for production environments.

Here is an example of updating the host address in the data source configuration:

{  "pluginId": "postgres-plugin",  "name": "my-postgres-db",  "datasourceConfiguration": {    "url": "jdbc:postgresql://db:5432/myDatabase",    "username": "fakeuser",    "password": "fakepassword"  }}