How to dockerize an application requiring Tomcat for development, and should Tomcat and the application be separate or a single docker container?

Goal
I am trying to improve development workflow for an application which uses Tomcat to run in development.

Current Workflow

  1. start Tomcat server
  2. in Tomcat the file server.xml dictates where on the local machine to find the META-INF and WEB-INF along with the application source
  3. visit browser at the host name and port 8080 provided in Tomcat’s server.xml

Problem
My thinking is to make Tomcat it’s own container container, and the Application (including WEB-INF and META-INF) another container.

But how can they talk to each other and how can Tomcat in container 1 find a file inside of Application in container 2, and then be able to run this application in development?

Thank you so much in advance!

Hi,

I think the easiest “starter” solution will be to have just 1 Container that will hold the Tomcat server. Store the app related files on a directory in the Docker host; then use that directory as a Volume in this Container that holds the Tomcat server.

Now when you run this Container, the Tomcat server there will use the files in that directory and you should be good.

Once you got this working, you can look into Volume Containers and other cool stuff.

Let me know how this goes. Cheers.

-Joe