Accessing to the database from outside the container

(Martial) #1

How can i access to the database from ouside the container but in the same server (local)

I open the port in app.yml

  - "4002:5432" #postgres

Try to connect from outside with

psql -h -p 4002 -d postgres -U postgres -p ''
psql: could not connect to server: Connection refused
        Is the server running on host "" and accepting
        TCP/IP connections on port 5432?

What i’m missing ?

(Matt Palmer) #2

Did you rebuild the container after editing app.yml? That’s necessary to make changes effective in the running system.

(Martial) #3

Yep multiple time ! :weary:

(Matt Palmer) #4

I can’t reproduce the problem. If I do what you describe, it Works For Me. Presumably there’s some other sort of customisation you’ve applied, but not mentioned, that’s causing the problem.

Incidentally, since you’re running on the same machine, you don’t have to expose the port, you can just connect to the Docker-internal IP (172.17.0.<X>) on port 5432 and it should work.

(system) automatically bumped #7
(Sam Saffron) closed #8