Dhanu
Dhanu

Reputation: 36

Do spring boot apps need dockerization?

Any Recommendation on spring boot apps need dockerization?

Increase Deployment Time with Dockerization?

a. Spring boot app with docker then has to go with building image -> pushing to docker registry -> then pull from docker registry and at last running it.
b. whole process takes time and Continuos deployment is taking now time.

Since spring boot comes with embedded tomcat, is it not advisable to run executable jar file as java -jar and you just need JRE on the deployable host?

let me know your thoughts on this..

Upvotes: 1

Views: 985

Answers (1)

alexbt
alexbt

Reputation: 17045

Your post contains several questions, which are not all clear for me. I'm essentially answering do the title question:

Do spring boot apps need dockerization?

Yes, it does makes sense. Your Spring Boot application still runs on an OS, with some patches installed, perhaps with a database, a JRE, opened ports and a bunch of other stuff that needs configuration.

Then, for x reasons, your setup in LAB may differ than the one in Qualification or Production: not the same OS, not the same home directory, environment variables, opened ports, some command doesn't work in environment x, other command only works in y...

At the very least, Dockerizing a Spring Boot application allows you to run with the same configuration in all your environments. It's technically easier to reproduce a bug if the developer is able to run with exactly the same environment as to where the bug occurred.

Interesting article: how-to-deploy-spring-boot-applications-in-docker-containers:

Despite Spring Boot simplifying a lot of things, the reality of deploying a microservices app remains complex. If you package it with RPM, you may still have to deal with dependency version concerns, conflicting ports, etc. That’s where immutable infrastructure comes into play.

Check this other article: https://dzone.com/articles/dockerizing-spring-boot-applications.

A few months ago I have started new personal project called JVM Bloggers with a goal to help Polish programmers with spreading news about their new blog posts. Initially this Spring Boot application was hosted on my local machine, then I have migrated it to free account on Heroku.

And for first weeks I was satisfied: application didn’t have to be online 24/7 so sleeping for 8 hours per day (limitation of free Heroku account) was not a big problem, 500 MB memory cap didn’t limit me too. But as JVM Bloggers grown I started to encounter strange issues with memory usage: application started to consume 500-550MB and it was very difficult to find a source of this behaviour. I even left application running on my local machine with a profiler attached but still didn’t find anything suspicious.

Memory footprint problems became irritating as I had to monitor application and restart it every 1-2 days and due to Heroku nature I could not simply ssh to the server and debug or attach profiler to running process. It became clear that if I am going to add more features to JVM Bloggers I have to migrate it to something more flexible – a Linux machine with Docker.

Upvotes: 4

Related Questions