Localhost postgres docker ‘Connection refused’ using pgAdmin

Sami C.
1 min readJan 3, 2019

--

The Problem

I’ve found out that when running a pgadmin and postgres in docker that you’ll end up having problems when connecting to the localhost:5342 (which is the port that the postgres db is connected on)

How to fix this?

Run the following command to get the id of the container you want:

docker ps

Run the following command to get the ip address of postgres image file that is running on docker:

docker inspect <Container-ID>

You’ll have to look for the IPAddress field, and copy that number into your postgres connection.

That’s all!

--

--

Sami C.
Sami C.

Written by Sami C.

Freelance Software Engineer

Responses (4)