


How to follow MVC architecture in web app Using Node, Express, Postgresql.Docker NodeJS app cant connect to postgres database.Cannot connect to remote PostgreSQL instance from Django app running within Docker container.Problems connecting Docker container to PostgreSQL in App Engine using Flask.How to connect to PostgreSQL from Phoenix Web App via SSL?.How to connect Docker web app container to Docker PostgreSQL container?.Using Docker to launch web app, can't connect to Postgresql DB?.

Modify your db config file to use an alias instead of localhost: connectionURL="jdbc:postgresql://DB_ALIAS/admin?stringtype=unspecified"Then add the DB_ALIAS to the container's hosts : $ sudo docker run -add-host DB_ALIAS:192.168.5.1 -it. Edit the file /etc/hosts to point the localhost to docker host ip: $ sudo vim /etc/hosts.Enter your container: $ sudo docker exec -it /bin/bash.Get your docker host ip: $ sudo docker inspect -f ''.Change the localhost of your docker host ip inside the container If you wanna hardcode the "localhost:5432" inside your config xml, the easiest way is creating your container with the option "-net=host": $ sudo docker run -net=host -it. Then you don't have 5432 listening in your container: $ sudo docker exec nc -v -z localhost 5432 Cat your container's /etc/hosts $ sudo docker exec -it cat /etc/hostsįor docker networks is bridge by default, the localhost inside points to container itself( Docker default bridge network).
