What is Docker?
Docker is the world’s leading software container platform. Docker is a program designed to make it easier to deploy and run applications by using containers. Docker makes the process of application deployment very easy and efficient and resolves a lot of issues in deploying the application.
Let’s understand this in a slightly different way. Today when we talk about software it is not just a single piece of code. However it is an entire software stack and a typical software application will consist of a group of front-end, back-end component, databases, servers, libraries, and other environment dependent components.
We also have to ensure that all these components work on different and a wide range of platforms. When we look at the picture it becomes very complex to ensure that each of the components works on every possible platform where the application is expected to run.
This problem can be solved by using Docker. Containers allow a developer to package up an application with all of its parts it needs, such as libraries and other dependencies, and ship it all out as one package.
Now you can imagine a developer will package the software and its components into the box which we call container and Docker will take care of shipping this container to all the possible platforms is a standard way. This is how we resolve the issue of an application working on one environment or a platform and not working on other.
How DOCKER works | Docker Architecture
Now I’ll tell you how Docker works. Before we understand the working of Docker let’s look at a general workflow of Docker. So, in the Docker workflow, our developer will define all the application and its dependencies and in a file which is called as Docker file.
This Docker file can be used to create Docker Images, so, in a Docker image you will have all the application its requirements and dependencies and when you run a Docker image you get Docker containers.
Docker containers are the runtime instance of a Docker image and these images can also be stored in an online cloud repository which is called as Docker hub. If you go to Docker hub you will find a lot of publicly available images and you can store your own Docker image as well. We can also store Docker image in our own repository or version control system.
Now, these images can be pulled to create containers in any environment so you can create a Docker container in a test environment or any other environment and we can be sure that our application will run in the same way using Docker containers. This resolves the issue of the app working on one platform and not on other.
Virtualization Vs Containerization
Docker is a container platform it will it will be very useful if you understand what the difference between containerization versus virtualization? And what is the benefit of using container platform like Docker?
In the concept of virtualization, we have a software which is called hypervisor and which is used to create and run virtual machines. Using hypervisor we can create multiple virtual machines on a host operating system. These virtual machines have their own operating system and it does use the host operating system, so, there can be an overhead on the host platform.
Virtual Machines (VM): Resources allocation is fixed and does not change per application needs.
In the case of virtual machines, we have to allocate a fixed memory and space to every machine so there is a lot of wastage of resources.
In containerization, we have a container engine and we don’t have a separate operating system. But we have containers where we have the application and all its dependencies and it will use the host operating system. In containerization space, memory and other resources are not fixed, it will be taken will be taken as per the need of the application, so, there is no overhead and it is very lightweight.
Now, there can be scenarios where we need a virtual machine over a host operating system and then we have containers for example, if you want to run a windows application on a Linux operating system, we need to have a virtual machine first which will have an operating system and then we can have containers over it. In the case of Docker, the container engineer is our Docker engine.
Docker has a client-server Architecture
Docker has a client-server Architecture, let us understand it in a very easy way, in Docker command-line interface is the client and we have the Docker server which has all the containers and the Docker server receives commands from the Docker client in the form of commands or a REST API request. All the components of Docker client and server together form a Docker engine.
The Docker daemon or the server receives the command from the Docker client through REST API or command line interface. The Docker client or Docker demon can be present on the same platform or on different machines.