Using docker-compose with passenger-ruby base image for multiple web apps

I’m a Docker newbie but I was able to follow some advice somewhere and set up docker-compose with two services in the .yml file:

  • “db”, an image that just references the “library/mysql” image.
  • “web”, a build that uses the Dockerfile in the current directory, based on the “phusion/passenger-ruby19” base image, then sets up nginx, and ADDs the Gemfile and application project.

If I want to add another web application, I guess I just add another build to the docker-compose.yml from a separate directory on the Docker host, and it will run in its own container with separate ports.

Is there a way to have the web applications in both containers (or “services”) exposed to the public on port 80, but at either different host name/IP addresses or different paths on the same host name/IP address? Could I install a master nginx proxy container with docker-compose that listens on port 80 and then proxies out to the various passenger-ruby container passenger proxies, which would listen on different ports in each web app server/container?

Or should I put both web applications in the same phusion/passenger image? That removes the nice isolation features of separate containers, though.

Does this make any sense?

you want to add haproxy or varnish in front then you can split traffic between containers.