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/jeromejahnke Dec 12 '22

It is less about the environment your app runs in and more about the system your app runs in. So all the connections into and out of the machine are easier to manage with containers. Version dependencies for your app are easier with containers, where your workload is running is easier with containers. Think bigger when thinking about containers. I used to have systems that would run on 100 machines in 5 data centers. And making sure everything was connected and up to date took an enormous amount of time. But now it runs on more machines and in more data centers but takes a LOT less work cause Containers and Container Management.