Nerd For Tech
Published in

Nerd For Tech

Containerization using Docker — Oversimplified

Container

Imagine you have a spring boot application running in your local that uses Java 11, some external dependencies, and few environment variables. If you want to run that application in any other machine, you will have to bundle the application into a runnable JAR, install Java 11 in the machine and set environment variable. What if you could just isolate the whole runtime environment you had in your local system and replicate it anywhere you want?

A container is just that, an isolated runtime that hold your application and its dependencies.

Cool isn’t it? But how or from what do you spin up a container?

Container/Docker Image

A snapshot that freezes the application and its dependencies. This snapshot at runtime becomes container. In essence, you create an image of your application and can spin up a container using that image in any system.

Awesome, this clarifies that it is the container image that holds everything and is used to create runtime containers to create instance of the application. But how to we create or build the image?

Dockerfile

In docker you write down the steps or instruction to generate a container image using Dockerfile.

Why Containerize your application?

Portability — Build the image once and deploy it in any infrastructure or hardware.

Consistency — Performance and behavior of your application remain same irrespective of which platform it is deployed on. How many times have seen situation where the application works in the DEV environment but not in the QA environment? Containerization can help us avoid discrepancies across environment.

Horizontal scaling — Spinning up a new instance of the application to support horizontal scaling is seamless thanks to containerization. You obviously would need a container orchestration like Kubernetes or Swarm to manage auto scaling.

Infrastructure efficient — System requirement of containerized application are lesser as compared to VM type of setup.

The oversimplified series is meant to provide you a sneak peek into important software concepts. It is advisable to go through official documentations for a more thorough understanding of Docker and Containerization in general.

Happy Learning!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store