Hello I have a problem with my docker compose postgres and pgadmin
Error:
Error: connect ETIMEDOUT 172.19.0.2:5432 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16) { errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect',
address: '172.19.0.2', port: 5432 }
my docker compose:
version: "3.7"
services:
postgres:
image: postgres:12
restart: always
container_name: "postgres_container"
ports:
- "5432:5432"
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: spirit
POSTGRES_PASSWORD: emasa
POSTGRES_DB: emasa
pgadmin:
image: dpage/pgadmin4
container_name: "pgadmin_container"
depends_on:
- postgres
ports:
- 5050:80
environment:
PGADMIN_DEFAULT_EMAIL: emasa@emasa.com
PGADMIN_DEFAULT_PASSWORD: admin
volumes:
db_data:
i’m not able to imagine the reason for my error i give a docker-compose log and my postgres works normal:
postgres_container | 2020-03-19 02:48:12.162 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres_container | 2020-03-19 02:48:12.162 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres_container | 2020-03-19 02:48:12.184 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_container | 2020-03-19 02:48:12.256 UTC [24] LOG: database system was shut down at 2020-03-19 02:48:04 UTC
postgres_container | 2020-03-19 02:48:12.290 UTC [1] LOG: database system is ready to accept connections
I think the problem is this: listening on IPv4 address “0.0.0.0”, port 5432
and this is my config:
{
"type": "postgres",
"host": "172.19.0.2",
"port": 5432,
"username": "spirit",
"password": "emasa",
"database": "emasa",
"synchronize": true,
"logging": false,
"entities": ["src/entity/**/*.ts"],
"migrations": ["src/migration/**/*.ts"],
"subscribers": ["src/subscriber/**/*.ts"],
"cli": {
"entitiesDir": "src/entity",
"migrationsDir": "src/migration",
"subscribersDir": "src/subscriber"
}
}