by BehindJava
What is Container in Microservices
In this tutorial, we are going to learn about a Container in Microservices.
Container in Microservices
-
A Container is a bundling of an application or Microservice and all its dependencies as a package, that allows it to deploy easily and consistently regardless of the environment.
- For example, A software that runs only on a Linux machine that uses MySQL can be deployed into a Windows server without having to install my MySQL on that server.
- Containers use the virtualization features of the host operating system.
-
So if you want to run containers on an operating system, that operating system must support virtualization.
- For example, Windows 10 Home Edition doesn’t support the virtualization feature. But the Windows Server and Windows 10 Pro do support the virtualization feature.
- You cannot package operating system. But docker knows which operating system is required. So that using the virtualization feature brings up the operating system.
-
Containers also allow us to deploy microservices to different environments. Also, services can be built with different technologies and run side by side.
- For example, you have built three microservices with three different languages, i.e., Java, Dot Net and Python and build a container for each of those microservices and deploy them on the same machine without installing the Java SDK or .Net Runtime or python on that server.
Here is the example of a Dockerized app, which means it is a containerized application.
- User wants to access a WordPress website and the WordPress users might see Quill in this operating system.
- So instead of installing WordPress and MySQL on that operating system.
- We can deploy a container that includes Nginx that handles the web requests and configure it to communicate with the WordPress container.
- And we also create a network between WordPress container and MySQL or MariaDB container.
- They use each other, but they are independent. They don’t interact with each other in terms of components that they have inside them. Instead, they only talk to each other via their interfaces.