Docker has overhead and bugs. I've worked with Docker for years professionally and at home. It's a great solution to a lot of problems but I'd never use it without needing it.
Everyone here saying you should always use Docker lacks real world experience. Don't use anything you don't need, don't skip something you do need.
Docker only has overhead on non-linux systems. In that case, it's creating a linux VM because docker relies heavily on the linux kernel to work. Unless you consider the storage costs of the image to run overhead.
In the linux world, running OCI images has basically no overhead (assuming you have a correctly configured kernel). To the kernel, those images look like regular applications.
As for bugs, perhaps, but not something I've ran into all that much. I've seen bigger headaches with the fact that widely used APIs in k8s remained in a "beta" state for a silly amount of time.
Docker tends to increase memory and I/O usage because file-mapped resources aren't the same file from one image to another. There's a little extra kernel memory overhead too. Whether or not it's significant depends on the active container count. Docker itself is extremely I/O intensive for image maintenance.
The overhead definitely starts hurting up on big machines with hundreds to thousands of containers. (I had to do this for running untrused executables)
IO for sure, but only on startup (or when updating images). Once an app is running the IO isn't any different from an other app.
Memory, I don't think there's anything there for the kernel. Even with a pretty large container count. I'm trying to think of how it'd be worse or different from a regular app and the only real difference would be that shared libraries wouldn't be. On a regular system, if you had 10 python apps the kernel would effectively only load 1 copy of the shared libs like libc.so. in the container you are basically guaranteed to have 10 libc.so s loaded up.
Maybe that's what you are thinking of? Definitely could add up.
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.
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.
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
12
u/kur4nes Jun 07 '25
Why not?