Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use docker? Aren't java files like WAR files already running on JVM?

Tags:

docker

I'm new to using java and have just started getting a grasp of the build process and dependency management system of Maven and Gradle.

From what I understand, Docker is a great tool for deploying containers inside of a docker host. I imagine this is useful in the same way Vagrant is (although not functionally the same) in that it removes the issue of the environment not being what was expected.

It was my understanding that when building things with Maven or Gradle that you could create a JAR file or a WAR file that included the binaries inside them so it could run wherever the JVM was. With Docker, this seems redundant. I imagine that Docker is could be used for other things like programs running from C++ or anything else? Is Docker redundant for Java usage?

like image 563
Alexander Kleinhans Avatar asked Dec 28 '15 02:12

Alexander Kleinhans


1 Answers

Docker is about isolation and reproducibility.

The last point allows to specify an execution environment, with the exact brand of JDK/JVM that you need, for you to run on a dev machine (with a VM) or in production.

Years laters, even if you can no longer download the precise update revision of the JDK you used when you initially deployed that project, you will still be able to reproduce that execution environment.

like image 112
VonC Avatar answered Nov 15 '22 06:11

VonC