container can't connect to postgres on host, connection refused
Docker Desktop 4.30 on macOS Sonoma, running a Django container via docker compose up. Postgres is installed natively on the Mac on localhost:5432. Inside the container psql -h localhost -U postgres gives psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused. I tried host.docker.internal and it still refuses. Docker network is default bridge. What am I missing here?
3 replies