I have difficulties to connect to my postgresql via IntelliJ. I am using this docker-compose file:
version: '3'
services:
db:
image: postgres
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: postgres_password
PG_DATA: /var/lib/postgresql/data/pgdatai
expose:
- "5432"
ports:
- "5432"
volumes:
- /var/lib/postresql/db/
deploy:
placement:
constraints:
- node.hostname == vmAPT1
I put this inside by command:
docker stack deploy --compose-file docker-compose.yml vmAPT1
when I use:
docker ps
I see:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
31d1337a142c postgres:latest "docker-entrypoint..." 30 minutes ago Up 30 minutes 5432/tcp vmAPI1_db.1
And when I am trying simply to connect to db by IntelliJ:
jdbc:postgresql://192.168.200.140:5432/postgres
I am recieving that connection failed. How to handle that?? I thought that the port is open for connections
I found the problem: mistake in yml file: instead of
should be: