Unable to connect to Postgres on Docker container via pgAdmin

I pulled out a postgres image using postgres for docker. I also tried to run the image from https://docs.docker.com/examples/postgresql_service/

I run them with the -p 5432: 5432 option, but cannot connect to pgAdmin. This gave me a wait time when I tried to connect through localhost: 5432. The examples I found on the Internet say just use -p. I did, and it won’t work. Also, security settings, at least from the example above, are very permissive. Any suggestions?

+5
source share
2 answers

Depending on how you started Docker, this is unlikely to work. Docker Daemon runs on a virtual machine in OS X, which means that you really need to connect to this IP address (and not the local host). To find this IP address, enter the following:

docker-machine ip default

The IP address you return will tell you the IP address to connect.

+6
source

Examples I have followed Linux, but I don’t work for OS X. When you connect to postgres from OS X, you do not use "localhost: 5432", but IP: 5432. The correct IP address can be found from Kinematics container

-1
source

Source: https://habr.com/ru/post/1232915/


All Articles