How to access postgresql located on localhost from container

I want to access postgresql which resides on localhost from within the nodejs application container. How to do that? and what is the best practice to do that in production?

AFAIK you can only access node‘s localhost from within container with special settings in Docker Desktop.

For Production, use all services in container, use dedicated IP of host (not localhost) or create additional private IP (e.g. 10.x.x.x) on host to use.

1 Like