Add new Tomcat containers behind Apache with Docker

I have a Java web app running on Tomcat behind Apache. I want to launch a new Tomcat container for each new customer, but all of them behind the same Apache. Each client has its own subdomain, and Apache proxies them to the right Tomcat instance. Here is an example of my Apache configuration for one customer:


  • How to edit a .py script inside Docker Quickstart Terminal?
  • Docker to run X applications while connected through SSH
  • docker, --storage-opts and aufs storage-driver
  • Starting mysql container using docker machine with virtual box shared folder
  • Using Docker to mimic an existing Production server vs. deploying Docker containers to production?
  • DRY Config for Docker build and App
  • <VirtualHost *:80>
        ProxyPass / ajp://tomcat1:8009/
        ProxyPassReverse / ajp://tomcat1:8009/

    Then I start the Apache container with --link tomcat1 and everything works just fine.

    What I’m trying to figure out how to do is to add new Tomcat containers dynamically after the Apache container is already running and have Apache to reference them correctly.

    The issue is that even adding sites-enabled/app2.conf to the Apache container dynamically, it doesn’t work because when the Apache container didn’t have a --link tomcat2 when it was launched, hence it doesn’t know how to reach the new Tomcat container.

    Do you guys have any ideas of how I can get this to work other than stopping the Apache container and relaunching it with the --link tomcat2 argument?

  • Connect rails app in Docker container to external Postgresql Database via URL
  • Can't kill processes (originating in a docker container)
  • how to physically remove untagged docker images
  • Jenkins auto build by Github webhook is not working
  • Docker Compose: Exposing Environment Variables to linked service
  • Docker splunk logging driver - handshake failure
  • One Solution collect form web for “Add new Tomcat containers behind Apache with Docker”

    Links are considered legacy and have been replaced with networks. Join apache and all tomcat containers into the same bridge network to achieve direct connectivity between them, then you can create and remove tomcat containers at will.

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