I am new to docker. I have a Spring-boot application which I want to deploy and run using docker. Is it a good practice to put war file images in the container or it is better to put jar ones? why?
P.S. Once I read that it is better to "make jars , not wars" :-) but do not know the reason behind it.
Matt's answer is correct, but you have to consider some further points.
jar
you have to recompile your whole project to use that updated version. BTW most applicationservers have a autodeploy mechanism to deploy war's easily.One of the main reasons for building a docker image for your application is to provide an artefact that people can run without installing and managing external software dependencies (like an app server to run a war file).
From a container user perspective, it makes no difference whether you package your code in a jar or a war file or as a fortran binary. All they do is run a container image.
From your side, doing the Docker build and config management, packaging a jar file and copying will be a more simple solution than trying to setup and configure an app server to package then deploying each release into the app server. See Ohmens answer for some more technical components of the java build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With