Introduction to Docker
Tags: docker, devops, containers, cloud
Published: 2022-02-07 11:20:35

When you hear the term "**container**," the term "**Docker**" is frequently thrown into the mix. You may have heard phrases like "Docker container," you may be familiar with the company Docker, and you may have heard Docker referred to as a toolset for working with containers. These are all appropriate uses of the term "Docker," but there are obviously many other meanings available. This might be confusing for a lot of beginners, and may go into looking for wrong resources, so let me introduce you to Docker, in a simple way:)

Let's start with the most asked question, 

## What is Docker?

![Docker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ogg0vxh9v0d7857f4rx5.png) 

A standard definition of [**Docker**](https://www.docker.com/) on internet is: 

> an open-source project that automates the deployment of software applications inside containers by providing an additional layer of abstraction and automation of OS-level virtualization on Linux.

Now again, this is a complex bookish definition. Let me simplify it, Docker is a tool that enables developers, system administrators, and others to easily deploy their applications in a sandbox (called containers) to run on the host operating system, which in this case is Linux. Docker's main advantage is that it allows users to **bundle an application and all of its dependencies into a standardized unit** for software development. Containers, unlike virtual machines, have low overhead and thus allow for more efficient use of the underlying system and resources. 

Have you ever created an application that works flawlessly on your machine but fails miserably on someone else's? 

![Docker birth](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xamayxk1emsh7mwhfj3l.jpg)  

And this is how **Docker** was born! 😂😂

To learn Docker, you should be familiar with containers, containerization, virtualization, etc., for that refer to my previous blog post on [**Containers and Containerization**](https://dev.to/asmit2952/what-are-containers-3k10).

To read about Docker terminologies, like Docker Hub, Docker Daemon, Docker Client, read this blog post by [**MindMajix**](https://mindmajix.com/docker/basic-terminologies-of-docker)

## Why use Docker?   

Docker enables you to rapidly deploy server environments in “containers.” It allows you to ship your code faster and has more control over your applications. You don't have to clog your computer with all the tools you download for various projects, and you don't have to wait for hours to test an app. This is saving money by utilizing resources. Docker-based applications can be moved from development machines to production deployments with ease. Docker is useful for **Microservices**, **Data Processing**, **Continuous Integration and Delivery (CI/CD)**, and **Containers as a Service (CaaS)**.

![Docker working](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ah0oeyno9w3pwm0yk9cc.png) 

## Components of Docker architecture 

Within its core architecture, Docker includes the following components: 

* Images
* Containers
* Registries
* Docker Engine

![Docker Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/caj5t5u0j00hzlfss2ki.png) 

* **Images:**

Images are blueprints that contain instructions for building a Docker container. Images define:

  * Dependencies in applications
  * The processes that should be executed when the application is launched.

You can download images from Docker Hub or make your own by including specific instructions in a file called Dockerfile.
 
* **Containers:** 

Containers are live instances of images that run an application or its independent modules.

An image is a class in object-oriented programming, and the container is an instance of that class. This increases operational efficiency by allowing you to launch multiple containers from a single image.

![Docker image & container](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udyv0vd9lizyd1dxvok6.png)

* **Registries:** 

A Docker registry is like a repository of images.

The Docker Hub, a public registry that stores public and official images for various languages and platforms, is the default registry. By default, a Docker image request is searched within the Docker Hub registry.

You can also own a private registry and set it up to be the default source of images for your specific needs. When you pull an image, Docker searches the public registry for it and saves it on your local system on **DOCKER_HOST**. You can also save images locally or upload them to the public registry.

![Registries](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/99fua1do5z9loqrhnn6q.png)

* **Docker Engine:**

The Docker Engine is one of the key components of the Docker architecture that the application runs on. You could also think of the Docker Engine as a system-installed application that manages containers, images, and builds.

A Docker Engine is built on a client-server architecture and includes the following sub-components:

  * **Docker Daemon** is the server that runs on the host machine. It is in charge of creating and managing Docker images. 
<br> 
 
  * **The Docker Client** is a command-line interface (CLI) that allows you to send Docker commands to the Docker Daemon. Although a client can run on the host machine, it uses Docker Engine's REST API to communicate with the daemon remotely.
<br>

  * **A REST API** allows for interactions between the client and the daemon. 

![Docker Engine](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0526qab67wwryhp0rh3d.png) 

By reading this blog post, you now have a general idea of what Docker is. I would recommend you to go through these links below:

* [**Docker**](https://docs.docker.com/get-started/)

* [**Octo Talks**](https://blog.octo.com/i-am-a-developer-why-should-i-use-docker/)

* [**freeCodeCamp**](https://www.youtube.com/watch?v=3c-iBn73dDE)

## Happy Dockerizing!!🐳🚢