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

1,730 views
Skip to first unread message

Sitaram Sawant

unread,
Jul 27, 2016, 3:03:37 AM7/27/16
to Kobo Users
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?





Tino Kreutzer

unread,
Jul 27, 2016, 9:10:27 PM7/27/16
to Kobo Users
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.

rajan....@yipl.com.np

unread,
Nov 28, 2017, 11:43:00 PM11/28/17
to KoBoToolbox Users

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


Reply all
Reply to author
Forward
0 new messages