Note: This is just an informative post for beginners or nontech people or a layman.
Let’s start. ❤
What is a Container?
An object for holding or transporting something.
Definition as per Google.
Connecting Cloud Containers to Real-life Containers
As seen in the above definition, we are gonna learn something similar.
Imagine containers as a vessel or a holder.
Objects are our software applications, for better understanding lets just say they are food items like fruits or cake or Milk.
Container = box, vessel, holder, etc.
Objects = piece of code or software = fruits, vegetables, other food items.
Containers are nothing but vessels in which we will keep our food. Every food requires a different size, shape, and material of storage vessel. Some foods can be preserved in a plastic vessel, some can be in tetra-packs and some in cardboard boxes.
Think we have many fruits like apples, oranges, bananas, etc.
If we keep all of them together in one section of the refrigerator they might get rot faster as all of them have different nature and requires a different environment to remain good to eat. So here we use containers. We keep each of them in different containers so they don’t get rot. Each container is made up of materials that can keep a particular type of fruit good in shape. For containers made for apples can’t keep oranges, same for vise-versa.
Containers are specially designed to run a specific type of software. This helps them to remove all unwanted settings which are not required. That’s why containers are lightweight.
Container images are just a description of container which tell what type of and how to run the application. It means you can create a container using the image if it works for your application. Just like a product description on an online website where you see if a container is suitable for apple storage or not. If it is suitable you buy that container or search for others.😛
Containers vs Virtual Machines (VM)
Virtual Machines are like that section of refrigerator in which you can keep all fruits together under one type of environment which might be good for apples and oranges but not as good for bananas.
Assume if some fruits get rotten you can’t just remove the whole section you need to find and remove those rotten fruits. It will become costly and will consume time. With container it becomes easy, if one container gets damage you can replace it with another one as they are lightweight and faster to replace.
Containers are isolated so they don’t affect any other software or application running on the same machine. Whereas on Virtual Machines many applications run together in one environment which might interfere with other applications and make them stop working or slow.
Some applications might consume all the resources of a machine while they are on VM but with the container, we can control how much of what resources can be allocated to a specific application so other applications don’t lose their performance.
So this was all about containers, but you might be thinking the topic is on Docker. Well, Docker comes into play when there are larger applications.
Docker is an open-source platform for developing containers. Docker containers are evolving at great speed as they are open source there are many contributors to it. Docker hub has many numbers of containers images previously created and tested by many others. This reduces your developing time for images and you can just pick one which is suitable for your application.
Why Docker Containers?
Docker containers come with some extra features. Container Images available are made specifically for a purpose. There are many of the Official images directly provided by the tools and software organizations. They are secure, made according to industry standards, and lightweight.