Web application existing of several containers

Hi!

I hope that this Topic is under the right category.

I’m new to Docker and have therefore a question that I hope someone can help me with. I would like to get a deeper understanding on how Docker and how some of its components works. I have been reading the documentation and learnt a bit, but not enough, I would like to get some things explained to me.

I’m gonna explain my situation.

Now, I’m running a web application on CentOS. My application requires Java JDK, Tomcat and a Oracle Database Enterprise Edition 11.2.0.

First I create a Docker image containing the JDK, Tomcat and a Database (with Docker file nr. 1). Then I create a new Docker file that is based on the first one’s image. In this Docker file number 2, I specify all the commands that is required to install the web application. When installing this application, during its installation I must specify the path to the JDK, tomcat and the database. When doing it this way, it works, because Docker file number 2 is based on Docker file number 1’s image, and therefore has access to all the paths and files. I then run the latest image inside a container, done.

But…

The thing is now. Is it somehow possible to split these components into two containers. I would like to have a container running oracle database and all of the other stuff inside a second container. These two then make up for the complete web application.

Like this, then use compose (?) to make these two lay on top of each other and work as one unit.
Container 1
±------------------------+
| Oracle Database |
±------------------------+
Container 2
±----------------------------------------------+
| JDK, Tomcat and Web-application |
±----------------------------------------------+

Given the information about how this web-application is installed, is this somehow possible?

Thanks!