Cannot connect to local postgres via Docker

Hi folks,

I'm new to Metabase. I just installed it with Docker on Mac and tried to connect to my local postgres.

But I'm getting this error.

All information is correct, I'm also using Postico 2 and it works just fine.

Does anyone has similar experience?

FWIW, I saw this warning at docker-compose up, but I can access localhost:3000 anyway so I ignored it.

! metabase The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

In a Docker container, 127.0.0.1 is the container itself, so it can't work. You need to

  • make sure your PostgreSQL listen for connections from network interfaces
  • have a pg_hba.conf entry that allows your user to connect from the network address(es) used by the containers

In Linux I need to tell my PostgreSQL to listen on 172.17.0.1:5432 but I'm not sure if this works on Mac since there Docker runs in a VM instead of the main host OS... there might be more steps to do.

In a Docker container, 127.0.0.1 is the container itself, so it can't work.

Ahh I see! I just found this SO answer:

And replaced localhost with host.docker.internal and it worked!

You made my day, Thanks a lot Roberto!