0

I'm running pgAdmin in a docker container, trying to connect to Postgres running locally on my machine. No matter what IP address I enter, it gives an error saying :

"Unable to connect to server:

could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?"

My server is indeed running, and it is allowing external addresses (listen_addresses = '*').

I guess I'm just not using the correct IP address. What is the correct address I should use?

Here is my docker compose code:

version: '3'

services:
  pgadmin:
    image: dpage/pgadmin4
    ports:
      - "5000:80"
    environment:
      PGADMIN_DEFAULT_EMAIL: me@me.com
      PGADMIN_DEFAULT_PASSWORD: admin
      network_mode: host
  
restart: unless-stopped

pgAdmin screenshot here

Dr.X
  • 1

1 Answers1

0

if you use Linux try set 172.17.0.1 to host

Or host.docker.internal on windows https://docs.docker.com/docker-for-windows/networking/#use-cases-and-workarounds

Mac host.docker.internal https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds

Alan Millirud
  • 1,049
  • 7
  • 14