Docker Community Forums

Share and learn in the Docker community.

How to Enter Container's PostgreSQL by using local pgAdmin

Enter the docker desktop’s container PostgreSQL by using the installed PgAdmin in my local computer (not that container that contain pgAdmin)

I was manage to have two different container, one for postgresql and the second one is the pgadmin. (How To Install and Run PostgreSQL using Docker ? - DEV Community)

In order to enter the container’s postgresql I needed to retrieve the container’s ip adress (How to get a Docker container’s IP address from the host)

Then I was managed to enter the container’s postSQL by using the container’s pgAdmin.

The next phase to to use the local and installed pgadmin in order to enter the container’s database.

The same content of hostname/address, port, username and password I was using for the container’s pgadmin, I used the same content for the local pgadmin.

I retrieve the message “Unable to connect to server:”

What part am I missing in order to enter the container’s PostGreSQl by using the local pgadmin?

*Using win 10 pro

Thank you!

This uses:

docker run --name postgresql-container -p 5432:5432 -e POSTGRES_PASSWORD=somePassword -d postgres

This opens a port 5432 on your local machine (accessible by any application on that machine, not just to Docker applications) and maps that to the same port number in the container, hence to the PostgreSQL server running in that Docker container.

Assuming you ran the same command as shown above, you should be able to connect your local installation of pgAdmin to localhost:5432.