DEV Community

Cover image for Docker : Part 1 : A brief concept for firing the containers.

Posted on • Updated on

Docker : Part 1 : A brief concept for firing the containers.

Docker has been one of the most famous pieces of technology since its open source launch in 2013. A large number of businesses are contributing, and a large number of individuals are using and embracing it. So why is it so well-liked? What does it do that was not previously available? In this blog post, we'll go further into Docker's internals to better explain how it functions.Docker is a container management system. We've been hearing this buzzword for quite some time. Everyone is asking about Docker, so let's unpack what it is and get acquainted with the fundamentals of Docker. I can promise that after you've learned about Docker, you'll never look back on the other features and also other frameworks as its a very powerful tool. It if build for a reason.

The inventor says why they built it I highly recommend you watch this and also read my article completely.

So, what exactly is Docker? What are containers? What exactly are we doing, shipping containers in computers?
As we all know, when we design applications, such dependencies must be met in order for the programmed application to run. Now, if we submit this application to a coworker or acquaintance who is also working on the same project, odds are that when your friend or coworker runs this program, it will not run and will show random errors, or they will need to download and install all of the dependencies before running the application.

So, what causes this to happen? Maybe the version that you used to create the application may not match on your friend's computer, perhaps he/she does not have all of the dependencies installed on their machine for running the software, or maybe the versions don't match, there may be a variety of explanations why our program does not run on their machine, and they'll need to spend hours to solve any of the problems or to install all of the dependencies. There can be a number of reasons why our program may not run on their machine and they'll need to spend hours to solve all the problems or to setup the development environment.

This is where Docker containers come in. Think of containers as a comprehensive package for the application that wraps all of the dependencies/requirements into a single box called a container. If that container runs on your computer, it will run on any machine that has Docker installed, and your dilemma of "It runs on my machine" is forever solved.

Now, let's have a look at the Docker Architecture to distinguish it from virtual machines, since the two go hand in hand and many people don't know the difference.

Alt Text

As seen in the diagram above, the Docker engine is installed on the host operating system, and Docker containers are deployed on top of it. This means that Docker allows use of the Kernel of the underlying host.

Alt Text

A simple analogy of the virtual machine and the docker is as given above. (using Namespaces and Control Groups - These are technical topics and I don't want you to get overloaded by all of these topics at once, so I'll make a separate blog for these topics) to manage the containers lifecycle and this is why docker containers load up way faster than VMs.

In the case of a virtual machine, we have something called a hypervisor, which virtualizes hardware resources for each virtual machine. Each machine has its own fully functional operating system and kernel. When you boot up a Virtual Machine, it boots up a strong OS from scratch, which is why it takes time to boot.

VM's are the IaaS where they have the reference to the entire resource that is given to the user and is taken care of by the developers: To understand this I will be writing another blog on this topic)

Docker, for example, uses the host kernel, because when you spin up a container, it doesn't need to boot a whole operating system from scratch because it uses the host Operating System Resources. You can think about it in this way Instead of Virtualizing Hardware Resources Docker Virtualizes Hosts Operating System's Resources.

Using Docker, you can launch a container in seconds. Furthermore, these Containers are essentially a running instance of a Docker Image.

What exactly is this Docker Image?
Images are essentially a blueprint for our containers; consider images to be a class and containers to be objects of that class. In short, Containers are instances of images. We first construct a Docker image from a Dockerfile (which is nothing more than instructions for compiling a Docker image), and if that build is good, we can spin up the desired number of containers in using the Docker image created by the user.

Alt Text

As you will see, we start by creating a Dockerfile (instructions), then we create an image from that Dockerfile, and finally we start containers from that Docker Image.

So far, we've learned about Docker, containers, Dockerfiles, and Docker Images, as well as how Docker differs from a virtual machine.
This was just a high-level overview of everything; in the following posts, we'll dig deeper into both of these modules and take a look inside the Docker Engine and see how everything works under the hood to get a firm grasp on Docker, so stay tuned for some more docker updates and also follow my repository for some Docker Gyan - Docker Tutorial files

Thank you.

for knowing some more about the software architecture and the evolution of the software thus go and watch my podcast in youtube hyperlinked here.

Top comments (0)