A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

This is very similar to the package we build for Spring Boot Microservices. Our Spring Boot applications are packaged as Jar files which assume that the runtime environment has Java installed. Containers are packaged in such a way that they can run directly at operating system level. This helps to isolate the bundled softwares from its environment and ensure that they work uniformly. We will understand this topic in more detail with the help of following sections —

  • The background — This part will discuss the evolution of deployment patterns and technologies, resulting in the concept of Containers. I have already covered similar content in the article on Kubernetes. If you have already gone through this, you can skip this part.
  • How Containers Work? — This part will discuss Containers in more detail including its core components and functions.
  • Sample Implementation — We will do sample implementation based on Docker along with our Spring Boot Microservices. We will create and run containers for our already built services.

The background

Age of Physical Machines

In the early era, applications were deployed on the physical machines. Deploying one application per machine was very costly in terms of resource utilization. On the other hand if we try to optimize this, by deploying multiple applications on the same machine, it was not possible to define the resource boundaries. Failure in one application could have propagated to others systems.

Image for post

To understand this, lets say our physical machine is hosting two applications — E-commerce Application and the _Inventory Management System and _if the latter is eating up all the memory, most often our e-commerce system will stop working as well. _Virtualization _brought the much needed reform!

Age of Virtual Machines

The technology allowed us to run multiple _Virtual Machines _(VM) on the single physical machine with the clear separation of resources, platform, libraries and security.

Image for post

This facilitated better utilization of resources. Enterprises invested in the shared pool of _Virtual Machines, _which providedmore flexibility and scalability to the software systems.

If the holidays season require our e-commerce system to work with two machines, we can get the additional machine(virtual) much faster. When the holiday season is over, I can return back the additional _Virtual machine, _releasing the resources back to the shared pool.

The technology worked great, but soon the enterprises realized this is relatively heavier. It required the whole operating system to be installed, on each of the virtual machines. Additionally, though the procurement time was greatly reduced, but the pace did lag behind in the age of Agile Development and Microservices.

#containers #software-engineering #spring-boot #docker #virtualization

Spring Boot Microservices — Containerization
1.45 GEEK