PgAdmin Connecting to Postgres through Docker-compose results in "Unable to connect to server : timeout expired"

Viewed 1147

Consider the Docker-compose :

version: "3"
services:
  postgres_svc:
    image: postgres:12.0-alpine
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: myCoolPassword
      POSTGRES_DB: postgres      
    ports:
      - "5432:5432"


   ... More services

When I run Docker-compose up and run :

docker inspect <POSTGRES_ID> | grep Gateway >>> 192.168.16.1

or

docker inspect <POSTGRES_ID>| grep IPAddress  >>> 192.168.16.3

I get the IP/Gateway of the postgres container , and then in PGADMIN :

enter image description here

enter image description here

And the same thing for the IP 192.168.16.3.

How can we solve this connection problem ?

0 Answers
Related