Metabase not connecting to PostgreSQL database

Hi All,
I have installed the Metabase in a local instance using Docker in Windows Machine. I have also installed PostgreSQL and created a few databases and tables.

Now I am trying to fetch data from the PostgreSQL database to Metabase so that I can create the visualization in it. Still, the connection is not established between Metabase and Postgresql. I have given all the details correctly according to the documentation.
But it's showing an error as given below
"Hmm, we couldn't connect to the database. Make sure your Host and Port settings are correct"

Can anyone help me with what should values be added in the below fields?


Hi @hemanathgoud
It would be impossible for anyone to tell you what values you should input - only you could know that.
The Postgres database is located somewhere and has a hostname/IP address.

If you are running Postgres in another container or on the Docker host, then you'll need to reference that. This has nothing to do with Metabase or Postgres, but Docker networking, so try looking at https://stackoverflow.com/questions/28056522/access-host-database-from-a-docker-container
https://docs.docker.com/network/

I have installed PostgreSQL on my windows machine and it is not running on the docker instance.
The Metabase is running on a Docker instance in the same window machine.

The thing I need to know is what value should I give to Host and port parameters.

@hemanathgoud
If you don't know how Docker works, then I would recommend that you use Metabase JAR instead.
Host: host.docker.internal
Port: 5432 (if that is what the Postgres database is installed with)

1 Like

I might be wrong, but I don't think the issue is as much a lack of experience with Docker as it is Metabase's instructions for using Postgres/Docker. The docker guide clearly prompts for the localhost--your response to many other users asking the same question goes deep into IP configs...the old testament...MLA style...everything BUT the obvious answer: host.docker.internal.

change your Host to "host.docker.internal", it works for me