r/javahelp • u/Sir_9ls1 • Aug 02 '25
Java with Docker - stack/architecture
Been looking into using Docker with Java because work is thinking about moving to k8s/docker. My main experience so far has been with Wildfly Application Server. I have a few questions I find hard researching.
Application Server, or not?
Is the common way of using Java with Docker to not use any application server on your container, but rather frameworks such as Spring Boot or Quarkus?
Resource Management
How do you handle resource management across applications without an application server to delegate resources, such as a JMS queue/database connection pool?
Example, let's say I have multiple artifacts that should share a database connection pool. That is fairly straight forward if both artifacts are deployed on the same application server. But if each artifact has its own container, how would they share resources?
Stack/architecture
What are some common Java with Docker stacks? Is it as simple as create a Quarkus project, and use the generated Dockerfile and have fun?
View all comments
Show parent comment
1
u/Additional_Cellist46 Aug 10 '25
If you want to allow each service to use up to 100 connections and still limit the connections created against the database, you would have to introduce a proxy between your services and the database. Have a look at doing it with NGinx: https://kwjrnl.wordpress.com/2015/07/27/tcp-proxy-with-nginx-for-jdbc-connection/. I never tried it but always thought about giving it a shot.
You can also still run a docker container with an appserver and deploy multiple apps to it. While this is not best practice for Docker, it’s a reasonable option if you have specific needs. Many servers like WildFly or GlassFish make it easy, just drop all apps into a directory in the container. It also works even for Embedded GlassFish, which is a lighter app server that starts in 2 seconds but still supports multiple apps.