r/learnjava • • Dec 11 '22

Why containerize a Java program using Docker?

I'm learning Docker and the idea of having a container for a Java app seems redundant to me since the idea of a JVM should make the Java code run on any environment?

But maybe I'm missing something and see if others containerize their Java apps using Docker and why.

46 Upvotes

15 comments sorted by

View all comments

2

u/Azifor Dec 12 '22

You may not need to. Depends on your use case for your app.

But if you want it easily available to the world, then a container just throws in the underlying infrastructure to ensure it does without you needing to coordinate that part.