I asked a detailed question on stackoverflow, with images : https://stackoverflow.com/questions/65012898/cant-connect-to-postgresql-from-a-same-host-container
Here is a copy of the text :
I am using docker to manage my Django apps, and have the same configuration on my laptop and digital ocean :
From my laptop I can connect to PostGreSQL thanks to the adminR image (https://hub.docker.com/_/adminer)
But if I try to connect to PostGreSQL from adminer on the localhost, I can’t !
I can ping and find PostGreSQL from the django container, but I can’t migrate my database from django scripts.
Funny enough, I can migrate on the digital ocean cloud from my laptop : and I can see the updated database on my laptop’s admineR page.
So the issue is obviously an issue of networking between the containers… But if I can ping the service, why can’t django access it ???
(Please refer to Stackoverflow’s question to have schema and images explaining the whole thing : https://stackoverflow.com/questions/65012898/cant-connect-to-postgresql-from-a-same-host-container )