A closer look to docker
Tags: docker
Published: 2022-11-17 10:29:53

## Motivation

In early years of software development process regarding to deploy software on multiple machines you have to repeat deployment steps for every machine you have, Then the need of isolating applications with it’s own dependencies and libraries to be compatible with versions and reduce the overhead of repeating this work on multiple machines/servers came up.

## One step ahead, Virtual Machine

VM is a guest Operating System can be run on top of another OS on same hardware and sharing physical components and resources of that machine by using a middle ware the helping in sharing resources operation.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04cu84ty1h2mrgkydrpt.png)

## Virtual Machine Pros & Cons

**Pros**
● Portable
● Less hardware cost
● Supports legacy operating systems

**Cons**
● Consuming resource
● Less performance

## Another step ahead, Containers (Docker)

Docker is a software creates isolated containers that hold a software with it’s own libraries that can be run on any OS and can be transferred from machine to another through docker images.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ptprh8laq1eonvexkx8t.png)

## Docker Components

**Docker client**

Docker client is responsible for taking the commands from user like (docker ps, docker images) and talk to docker server to execute the command.

**Docker Server**

Docker server also known as Docker daemon responsible for running the commands that come from docker client like listing the images, run container and so on..

**Docker Host**

Docker host is the host operating system for docker which docker uses to share it’s resources with containers.

**Docker Image**

A read-only and sharable set of files that are compiles to create one or more container.

**Docker Container**

Is a writable instance of image and each container has it’s own file system layer.

**Docker Repository**

It’s a repository of docker images you can deal with it as git repository review your images add tags to your updates and so on.

**Docker Registry**

A place responsible for providing docker images, that users can upload and download images like docker hub, thus you don't need to install any software from scratch and handle its' configuration, just pull the image and run the container.

## Docker components interaction


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hkki84e9d1hd17f4j3sr.png)

## Docker container holds a process

Each docker container has a process that starts when you execute docker run command, When this process is finished the container stopped and as much as process is running container will be working as well.

## How Docker containers run among any OS?

First of all, any docker image is already built on top of **Linux** OS and that the common in docker world, so when the container runs on Linux system this OS will be docker host directly, Then the container can use up to 100% of machine resources.

On the other hand when we use Docker on top of **Mac or Windows**, there is software called **Docker Desktop** you have to install, this application installs internally a small version of **Linux** OS and this will be the Docker Host and also docker desktop allow you to **manage** how much resources can docker take for containers.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62p3gi2rfhjcn7qehkdv.png)

**Long short story: You always run containers based on Linux OS**

**Note: there is a windows based images also but it’s not common to use.**

**IF YOU LIKED THE POST, THEN YOU CAN SUPPPORT SUCH CONTENT WITH A CUP OF COFFEE, THANKS IN ADVANCE.**

<a href="https://www.buymeacoffee.com/samehmuh95" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>