Use multiple services within one container (Tomcat, Filebeat)

Hi,

I would like to Dockerize my Java Web Application which runs within a Tomcat Server. In my current setup I run this on a Debian Buster with OpenJDK14. To collect my logs I use Filebeat with shipment to a Elasticsearch cluster.

What would be the best way to build this within docker? I would start using the image “tomcat:9.0-jdk14-openjdk-buster” as FROM within the Dockerfile. But how do I add additional services like filebeat which needs to access the log files generated by tomcat?

Thanks in advance!

docker moto is “one service is one container”. So Filebeat should be running in a dedicated container (in the kubernetes world, we talk about “sidecar”).
Then all you need is a shared volume between the 2 containers so your java apps can write its log there and Filebeat will consume the file from there.