How can Connect to Postgresql in a docker container from local machine

I have Postgresql on a server in a docker container. How can I connect to it from the outside, that is, from my local computer?
What setting should I apply to allow that?

Hi Sitaram,
The postgres username and password are set in this env file. To access postgres you would need to run a command such as docker exec -it kobodocker_psql_1 … I believe. Please check the docker documentation and posts for more background on that.

Best,

Tino

···

On Wed, Jul 27, 2016 at 3:03 AM Sitaram Sawant sitarams...@gmail.com wrote:

I have Postgresql on a server in a docker container. How can I connect to it from the outside, that is, from my local computer?
What setting should I apply to allow that?

You received this message because you are subscribed to the Google Groups “Kobo Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+...@googlegroups.com.

To post to this group, send email to kobo-...@googlegroups.com.

Visit this group at https://groups.google.com/group/kobo-users.

For more options, visit https://groups.google.com/d/optout.

Hi Guys,
What idid to access the Postgres from my local machine is:

psql -h 172.17.0.4 -p 5432 -U kobo -d kobotoolbox

``

to find the IP of Postgres you can use

docker inspect kobodocker_postgres_1

``

Or you can even use Postgres user to access the database:

Open shell for Postgres

docker exec -it kobodocker_postgres_1 bash

``

Change user

su - postgres

``

Change password

psql
ALTER USER postgres PASSWORD ‘postgres’;

``

Login Outside of Docker

psql -h 172.17.0.4 -p 5432 -U postgres

``

···

On Wednesday, July 27, 2016 at 12:48:37 PM UTC+5:45, Sitaram Sawant wrote:

I have Postgresql on a server in a docker container. How can I connect to it from the outside, that is, from my local computer?
What setting should I apply to allow that?

Hello, some one could share me a link to conect kobo with postgresql.
Thanks.