Can't connect to my local postgres database

I am running my metabase instance inside Docker with the following command:

docker run -d --add-host host.docker.internal:host-gateway -p 3000:3000 --name metabase metabase/metabase

The --add-host option was recommended in multiple places including: here. It allows the Docker image to interact with the host device.

My Postgres server is running on localhost of my device at postgresql://localhost:5432. So I should be able to connect with the following settings:


but this isn't working.

Can someone help me with this?

A container can’t scape and connect to an external db. I suggest you put the database in the same network as the container or run the jar file