rmcsharry February 2016

Cannot connect to Postgres running in Docker from PGAdmin running on Windows Host

I have read all the questions on this, like this one, but it does not help.

Host: Windows 10, running VirtualBox and PgAdmin.

I have setup Docker correctly and run a few containers without issue. Now I tried to setup Postgres. I tried two:

1 https://hub.docker.com/r/paintedfox/postgresql/

2 https://hub.docker.com/_/postgres/

And both have the same issue. When I try to connect from PgAdmin, it says the server does not listen.

When I run docker inspect postgres I see

"NetworkSettings": { "Bridge": "", "SandboxID": "6ad76f4d61017c44f814c5ec7ab9081a650d925a46c2b69902c4f0e5209076ce", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "5432/tcp": null }, "SandboxKey": "/var/run/docker/netns/6ad76f4d6101", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "3f14630554c972ac875cbb384725c6970d1d4d5acfba7cbc05e416b5b22f0056", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2",

I have tried that IP address as the host in PGAdmin.

I have tried setting the container with -p 5432:5432 and connecting as 127.0.0.1:5432.

I have tried setting port forwarding in VirtualBox for the container.

I also tried the machine host, as shown in Kitematic: 192.168.99.100

Answers


rmcsharry February 2016

I finally noticed that in Kitematc in the IP & Ports section on the Home tab that the ACCESS URL was not set.

Under Docker Port it shows '5432/tcp'

So I clicked the IP address next to that and set it and now it shows:

192.168.99.100:32768

I put that IP and port into PGAdmin and it can now connect to the container.

FYI that IP is the same IP returned by:

docker-machine ip default

Post Status

Asked in February 2016
Viewed 2,133 times
Voted 4
Answered 1 times

Search




Leave an answer