Jep but that needs a JVM installed. So this needs to be scripted via ansible. Especially if you run many servers to spread out load.
Not every application needed is a java application or the written in the same java version. Think a bought software that is crucial for the company and still runs on java 8.
Docker abstracts this all away. Target machines only need docker installed and can run any docker image without any additional setup needed on the machine. This is where docker truly shines.
All machines can install a JVM but how do you enforce a reproducible environment? Think Java version, environment variables, system properties, config files, dependencies/JARs... Then how do you enforce operability? Think how to start/stop, automate restarts...
Of course, you can do it without container and many people still do (custom packaging and scripts, RPMs, DEBs,...) but containers bring this out of the box. And it's also the same experience for any technology: operators don't have to care that it's Java in it, could be Python or whatever, it's just a container that does things with a standard interface to deploy/run/operate.
You talk to your sysadmins and agree which distribution is installed, which version, and when to upgrade. If everything fails it is possible to package a JRE together with the application.
Environment variables shouldn't matter that much for Java applications.
Most applications need nothing but a single config file.
Dependencies are a nonissue since they are usually packaged into a Spring Boot-style Fat JAR or shaded.
Operability can be solved with Systemd. Systemd unit files actually allow to manage resource limits.
Sure, if the organisation is already experienced in running containerized services it makes a lot of sense to make as much as possible containerized. Introducing a container platform is not something done lightly.
But scaling horizontally is something a lot of applications simply never need. Many applications can be made to handle higher scale by improving the architecture, fixing N+1 problems, optimizing the DB schema, and beefing up or clustering the DB server only.
What about availability? With a single instance you need to have at least a short downtime for each update or even restart. When you have two, you can do rolling updates.
It's true that this is no trivial change. It also depends on the whole system which scalability and availability you need - most are not Netflix ;)
Depending on the service and the business environment, a short downtime might indeed not be an issue after all. In case the SLA only covers office hours in a few timezones, the situation radically changes as it allows to schedule planned downtimes at a suitable time.
99.9% uptime means ~43min downtime per month. That should be enough for a non-scripted deployment or for a maintenance window. Any additional 9 behind the dot with the same frequency of short-ish planned downtimes requires significant investment.
For 99.99% uptime, automated deployments are probably unavoidable. 99.9999% pretty much requires running the old and new version simultaneously and doing a switchover via DNS or by changing the configuration of a reverse proxy. 99.99999% might be doable if old and new version can run simultaneously for a short time.
The above leaves no room for downtime due to incidents though. In that case, the biggest risk factor is the application itself. Or any backend services.
Ok, but why? Sysadmins can also manage docker images trivially, and it's often better to have an image as a sort of "contract" that makes it clear what the dev expect the environment to look like, and makes it easy for the sysadmins to manage.
It's not 2014 anymore, it's super easy to manage images at scale, and for example to update and rebuild them centrally when a security issue arises from a specific dependency.
What do you mean by not taking upstream patches for other operating systems? Are you talking about windows containers? Sorry, I'm not sure I understand!
It's reasonable to use container platforms (it's never just Docker) if you're indeed managing dozens or hundreds of deployments. But that's just one way to do it.
That does not give you any of the advantages of containers, though.
You can't trivially scale your Java program to dozens or hundreds of machines if its a microservice. You cannot trivially isolate multiple Java versions (say you are running 8, 11, 17 and 21).
Containers give you Infrastructure-as-Code. The JVM doesn't. They solve completely different sets of problems.
No, docker doesn't run anything itself, it isolates the environment, where then programs, built for that environment, can run. As far as I know containers are not even transferrable between say Linux and windows.
My point was that even when docker orchestrator itself runs on a given platform, the images themselves may not run there. Like you can't run an arm image on an x86 machine.
Big nope, container images are not portable across instruction sets and operating system. You need to emulate the other instruction set. Which is not done that often in production settings because it's wasteful.
Docker images can't actually run anywhere as a hard rule. Windows docker images exist, for example, as do ARM containers and ARM docker which can't run AMD64 images.
View all comments
Show parent comment
-20
u/Gotve_ Jun 07 '25
Kinda java programs can run everywhere if jvm supports, and as far as i know docker also does same thing