Containerisation – Brief Introduction
Hello everyone.. Hope you’re doing good. During this pandemic we’ve got a lot of time to learn new things and expand our horizons. Here I’m going to write a series of articles to explain and understand containerization using Docker. For other related articles please refer index page.
In order to understand all concepts better, I’ll suggest to install docker and execute commands as explained. Please refer : https://docs.docker.com/engine/install/ for installation. You can install any variant of Docker, I’ve installed Docker Desktop in my machine.
Containers V/S Virtual Machine :
Containers are widely used now a days as it provide a great benefit of having same environment throughout all the development life cycle as well as delivery. Before Containers many companies were using Virtual Machines for similar purpose, so let’s first understand difference between them.
As we can see in above image two distinct Virtual Machines runs on a same Hypervisor with different Guest OS whereas Containers removes additional overhead of having Guest OS and directly run on Docker Engine on Host Machine. We’ll understand how containers work internally in detail in future article.
There’s a primary question we hear a lot of time, is Docker the only way to achieve containerisation? The answer is No, docker isn’t the only way, there are many other ways to create containers, like Podman, CRI-O etc. Docker is one of the famous technology available and highly adapted.
Let’s quickly verify Docker installation.
docker -v / docker –version
This command will give you output something like below.
If you get similar result, you’re all ready to execute next command.
docker run hello-world
This command first downloads hello-world image and then execute the same as shown in above image. Let’s see another alternate way of echoing “hello-world” using docker image,
docker run alpine “echo” “hello-world”
Alpine is another image uploaded on docker registry. There are two scenarios. If docker image is not present in local, first image gets downloaded and then command is executed. But if you run that command again, image will not be downloaded as it’s already present in local. If everything works as shown above, we’ll understand it in detail in next article.
If in case you’re facing any difficulty installing / executing docker, post the same in comment. For other related articles please refer index page.
References : https://docs.docker.com/get-started/