EN VI

Postgresql - postresql installed locally and use pgadmin with docker ; can not connect to my local database?

2024-03-17 03:30:04
Postgresql - postresql installed locally and use pgadmin with docker ; can not connect to my local database

I'm leaning docker and i have some issues. I have installed postrgesql on my computer (ubuntu), really installed, not with docker. it was a classic installation

I also installed pgadmin, and everyting is fine.

Now that i want to learn docker, i decided to install pgadmin with docker and connect to my postresql server which installed locally on my machine? I did not uninstall pgadmin which was locally installed.

To laucnh pgadmin with docker,i have this command:

docker run -p 5050:80 e '[email protected]' -e 'PGADMIN_DEFAULT_PASSWORD=test123' -d dpage/pgadmin4

then i went to y browser and entered:

localhost:5050

pgadmin was launched in my brower, but i entered my crendentials given in docker;

Then i want to connect to my database, i gave the regular information:

**home address = localhost
port = 5432,
maintnance databatse = postgres
usermane = postgres**

password = *******

But i have a message which said it can't connect do I have to use 2 containers, one for pgadmin and one for pg?

Solution:

Change your localhost to 172.17.0.1 on Linux (Your case)

OBS: In some cases that will not be the default IP for Docker containers, so if that doesn't work, check your Docker IP using the following command:

ip -4 addr show scope global docker0

Change localhost to host.docker.internal on Windows and MacOS

Answer

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login