8

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

2 Answers 2

9

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
Sign up to request clarification or add additional context in comments.

Comments

1

If you run your container from command-line alter your run-command like this:

docker run -p 32768:5432 my-postgres

Now you can connect to your postgres via <mapped-ip>:32768 (in my case the mapped IP was 192.168.99.100)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.