I have dockerized database microservices. I can run manual queries using the following:
$ ssh user@foo.domain.com
$ docker exec -it postgres bash
docker$ psql -U postgres -h 127.0.0.1 -d postgres
The web services all talk to one another using a Docker bridged virtual network batman
.
networks:
batman:
driver: bridge
In alignment with PostgreSQL security best practices - I do not expose PostgreSQL port 5432 to the host machine at foo.domain.com. Only the sibling containers which are also in the 'batman' Docker network are allowed to connect to the database.
In a traditional DataGrip / PostgreSQL setup, I would ssh into the hosted box where PostgreSQL is served, and use a local PostgreSQL client (rules from: pg_hba.conf).
A Dockerized system requires one additional step (exec).
Seeing as DataGrip doesn't seem to allow prefixed connection commands, how do I use DataGrip to access a PostgreSQL instance behind a Docker virtual network?