Auto dockers containers by subdomain

I want to implement a SaaS schema and I need to solve an important part of its operation. My idea is to use docker containers configured according to the subdomain that is accessed. The variables of these containers are designated according to data stored in a database.
I have two possible approaches: Start and stop containers on demand through a proxy. One container per subdomain. Or a single container, and that the application is the one that changes the configuration according to the subdomain from which the request comes.
Which ones do you recommend? Is there any solution already worked out?

  • PostgreSQL PGDATA from host in Docker-System
  • Docker Machine to a remote server
  • How to configure docker registry to make a priority to local registry when PULL?
  • Docker won't publish selected ports
  • How can I add a file from my computer to a Docker container?
  • docker web server does not shut even after deletion
  • AWS Discovery only tries 3 ports 5701, 5702 & 5703 while joining cluster
  • Docker compose and concurrent integration testing
  • Run existing Wordpress site using Docker
  • What is POSTGIS_VERSION 2.1.7+dfsg-3~94.git954a8d0.pgdg80+1?
  • How to install docker specific version
  • Configure 3 Mesos instance with 1 master using docker and docker-compose
  • One Solution collect form web for “Auto dockers containers by subdomain”

    If I understand what your asking you want a PaaS a lot like heroku to manage apps running on a given domain? Rather than rolling your own logic for all of this I would take a look at Dokku. It’s a small PaaS implementation which deploys apps to a given subdomain via a git push + a Dockerfile.

    Dokku – Small PaaS based on Docker

    Another option would be Flynn but this is a lot heavier

    Flynn PaaS

    If your looking for your own implementation the Automated Proxy by jwilder would be a good image to use. It automatically configures a proxy to pass requests to a given subdomain based on a VIRTUAL_HOST and VIRTUAL_PORT env set on your app containers

    jwilder Automated Proxy

    Hope this helps!

    Dylan

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