How to build multi tenant application using docker

I am pretty much new to the docker concept and know basics of it.
I just wanted to know how can we build multi tenant application using docker.
Where the containers will use the local hosted database with different schema.With the nginx we can do reverse proxy but how we can achieve it?
because every container will be accessed by localhost:8080 and how we can add upstream and server part.
It will be very helpful if some one explains it to me.

  • PostgreSQL PGDATA from host in Docker-System
  • Docker best practices: single process for a container
  • How to use Docker Remote API from a linux container to it's Windows host
  • How do I run shell commands from myApp(python) container in myData(mongodb) container?
  • Nginx docker container not accepting and serving flask from container
  • I can not access my Container Docker Image by HTTP
  • Why can't you install docker natively in osx? [closed]
  • docker on OSX not returning container output through ssh,
  • How to run install pip requirements from private repo in google cloud source?
  • Setting volumes in docker-compose.yml file for windows 10 home
  • Access Windows 2016 Server Container (Docker container) via GUI?
  • Can fail2ban run in a separate docker container while somehow still implement iptables rules for nginx?
  • One Solution collect form web for “How to build multi tenant application using docker”

    If I understand correctly you want processes in containers to connect to resources on the host.

    From you containers perspective in bridge mode (the default), the host’s IP is the gateway. Unfortunate the gateway IP address may vary and can only be determinate at runtime.

    Here are a few ways to get it:

    • From the host using docker inspect: docker inspect <container name or ID>. The gateway will be available under NetworkSettings.Networks.Gateway.
    • From the container you can execute route | awk '/^default/ { print $2 }'

    One other possibility is to use --net=host when running your container.
    This will run you processes on the same network as your processes on your host. Doing so will make your database accessible from the container on localhost.

    Note that using --net=host will not work on Docker for mac/windows.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.