I have a Postgres database running in a docker container running on ubuntu server in a vm. I can connect to it from another computer on the network via psql no problem.
me@myPC:~$ psql -U myusername -h [my public ip] -p 8765 -d databasename
Password for user myusername:
psql (16.3 (Ubuntu 16.3-1.pgdg22.04+1))
Type "help" for help.
databasename=#SHOW listen_addresses;
listen_addresses
------------------
*
(1 row)
I cannot however access it from that same computer via R or python
Error: connection to server at "mydomian.com" (***.**.***.***), port 8675 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
To confuse things further, I am running adminer which was brought up on the same server via the same docker compose file that is accessible from off site which is what I want to be able to do with my postgres db.
services:
db:
image: postgres:latest
restart: always
container_name: db_container
volumes:
- pg-data:/var/lib/postgresql/data
networks:
- named-net
ports:
- "8765:5432"
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_NAME}
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"]
interval: 30s
timeout: 60s
retries: 5
start_period: 80s
adminer:
image: adminer
restart: always
ports:
- 8080:8080
networks:
- named-net
depends_on:
db:
condition: service_healthy
restart: true
networks:
named-net:
volumes:
pg-data:
nmap shows adminers port open on the host but not postgres but canyouseeme.org says it can see a service at that port.
ufw is inactive.
Anything I havent checked that could be blocking a connection?