0

I run postgres in a docker container on oracle cloud. I opened the port with iptables and via the oracle cloud web interface.
Somehow I can still not connect to the database using Datagrip. I also tried postgres.js, because that is what I would like to use to connect to it.

This is what i get, when it is not running:

DBMS: PostgreSQL (no ver.)
Case sensitivity: plain=mixed, delimited=exact
Connection to 000.000.000.000:<port> refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

This is what I get, when the database is running:

DBMS: PostgreSQL (no ver.)
Case sensitivity: plain=mixed, delimited=exact
Der Verbindungsversuch schlug fehl.

The errors I get using postgres.js:

when it is not running:

Error: connect ETIMEDOUT 000.000.000.000:<port>
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at __node_internal_exceptionWithHostPort (node:internal/errors:671:12)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '000.000.000.000:<port>',
  port: <port>
}

when it is running:

Error: connect ECONNREFUSED 000.000.000.000:<port>
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at __node_internal_exceptionWithHostPort (node:internal/errors:671:12)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
  errno: -4078,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '000.000.000.000:<port>',
  port: <port>
}

docker-compose.yml

version: '3.8'

services:
  postgres:
    image: postgres:16.3
    restart: always
    environment:
      POSTGRES_USER: nuxai
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: nuxai
    ports:
      - "<port>:<port>"
    volumes:
      - ./postgres-data:/var/lib/postgresql/data

output of sudo ss -nlpt | grep 5432:

LISTEN 0 65535 0.0.0.0:54320 0.0.0.0:* users:(("docker-proxy",pid=10770,fd=4)) 
LISTEN 0 65535 [::]:54320 [::]:* users:(("docker-proxy",pid=10777,fd=4))
2
  • Hi, Have you configured Oracle Cloud firewall to expose(make public) desired ports? Commented Jul 18, 2024 at 11:57
  • @VasiliiChernov Yes. I should have wrote that. I opened the port in the firewall settings using iptables and in the Oracle Cloud Web-Interface too. I think that worked, because I get a different error, when the database is running (see post). The problem is, that I can still not connect. Nevermind, I did write that. Commented Jul 18, 2024 at 12:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.