Connecting to host database from a Docker container
Generally speaking, in a production environment, you don't want things like Nginx and your database running in Docker containers. You want those services running on the host and your application(s) in a container. The tricky part here is that localhost in a container is the container's network, not the