Docker Chapter 1: Introduction

Docker Chapter 1: Introduction

In the beginning, the applications were hosted on a single dedicated hardware server. Because of the single dedicated hardware server, the user space, runtime environment was shared among other applications hosted on it, which in turn made the deployment hard and longer maintenance.

As things progressed, the virtualization of hardware came, and now we could make many virtual machines on top of single hardware. One hardware server can have many virtual machines with its own operating system (guest operating system). Using virtual machines we can have isolated apps with their own operating system, now has a guest operating system added load to the maintenance i.e. patching the operating system on the virtual machines.

As time passed, technology improved and we got containers. Containers sit on top of the host operating system, shares host operating systems kernel, binaries, and libraries. Thus taking away the extra burden of patching a hell of operating systems. And on top of that, containers can run almost everywhere, on a hardware server, virtual machines, cloud, etc., and also you can share. And Docker made the containers first-class citizen.

Installing Docker on Windows

Installing Docker on windows is a cakewalk, download the executable from docs.docker.com/desktop/windows/install and click next-next-finish (Run the executable with elevated permission). Please note that virtualization has to be enabled to docker work, and if you've any other kind of hypervisor software installed on your machine, like Oracle Virtual Box, VMWare WorkStation, you may get errors like Docker Daemon can not start. Uninstalling any other hypervisor software will solve it. StackOverflow link for docker not running: stackoverflow.com/questions/40459280/docker... To check if Docker is installed properly, run the below command.

docker container run hello-world

The command will download the hello-world image from the hub.docker.com repository and will run the container. Expected output: image.png

Architecture of Docker

The architecture of Docker consists of three major parts: Client, Host, and Registry. image.png The client communicates to the docker daemon either by socket or by RESTful API. The common commands used by docker client is as below:

docker image pull ...
docker image ls
docker container build ...
docker container ls

The docker daemon does the heavy work. It pulls, pushes, builds, runs and distributes containers and images. The docker daemon connects with either public or private registry to get images requested by the client.

The docker registry is the place to keep your images and share them. In other words, the docker registry is a docker repository that hosts one or more images. Docker Hub is a public registry.

Fundas

Docker's supreme objective is to run containers. The container is a virtualized isolated environment to run the application and consists of everything the application needs. An image is needed to get the container started. A Docker Image is an unchangeable file that contains source code, libraries, dependencies, tools, or anything which is defined to run the app. Images are applications and their virtual environment at a specific time i.e. a snapshot.

Unlike virtual machines, containers virtualize and isolate environments in a much efficient way. Instead of having a guest operating system, containers use the host of operating systems at the same time keeping the isolation. In the concept of the virtual machines, in the docker setup, the docker sits at the place of a hypervisor.

Did you find this article valuable?

Support Pawan Dubey's Blog by becoming a sponsor. Any amount is appreciated!