Docker: Brief Introduction.
Tags: docker, tutorial, microservices, programming
Published: 2022-07-23 19:38:58


## Docker: Brief Introduction.

### Learn about Docker containers, images, installations and everything you need to know about Docker.

![from [cloud savvy IT](https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.cloudsavvyit.com%2F10863%2Fhow-to-assess-docker-engine-security%2F&psig=AOvVaw0VnOeDDlQaW2ApB8Ex8-dP&ust=1650285079518000&source=images&cd=vfe&ved=0CA0QjhxqFwoTCOCEltSom_cCFQAAAAAdAAAAABAk)](https://cdn-images-1.medium.com/max/2400/0*qzSopAqbbqCWERcB)

### About Docker :
>  Docker is **an open source containerization platform**. It enables developers to package applications into containers — standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment. [IBM](https://www.ibm.com/in-en/cloud/learn/docker)

in simple words :
>  Docker is **an application build and deployment tool**. It is based on the idea of that you can package your code with dependencies into a deployable unit called a container. Containers have been around for quite some time. [nebula works](https://www.nebulaworks.com/insights/posts/what-is-docker-a-simple-explanation/)

in nutshell :

You experience this situation, The code works perfectly in my machine, but it doesn’t in others machines.

![](https://cdn-images-1.medium.com/max/2000/1*aGL8z5uIidZLYtJZK5UMAg.png)

the situation of when you shipped the code to production and it didn't work, but it works well in your machine.

![[credit](https://www.linkedin.com/pulse/making-works-my-machine-great-thing-hear-koon-emba-psm-pspo-togaf?trk=articles_directory)](https://cdn-images-1.medium.com/max/2000/1*LLaVpEBLXOKeH0rOGv6fLg.jpeg)

Here is where Docker introduce itself as the saver for you and your code,
it simply creates a container for your project files, directories, tools and everything your code needs, and that container can be used and run perfectly in any system or machine (your machine or the cloud host).

## Why use Docker:

 1. Solve the headache of “***It works on my machine…!!”
***with the code being in a container, it can be run everywhere

 2. a good solution for microservices architecture projects
turn every service of your product into a simple docker container
Containers aren’t required to implement microservices, but they are perfectly suited to the microservices approach and agile development processes generally.

 3. Docker enables faster software delivery cycles
make the process of CI/CD seamlessly and easy.
>  Enterprise software must respond quickly to changing conditions. That means both easy scaling to meet demand and easy updating to add new features as the business requires.
>  Docker containers make it easy to put new versions of software, with new business features, into production quickly — and to quickly roll back to a previous version if you need to. They also make it easier to implement strategies like blue/green deployments.

## Main Concepts:

let's dive a little bit into docker and get to know how it works under the hood and what its components.

### Containers:

A Docker container image is **a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings**.

also, A **container** is a runnable instance of an image. You can create, start, stop, move, or delete a **container** using the **Docker** API or CLI.

### Image:

A Docker image is **a file used to execute code in a Docker container**. Docker images act as a set of instructions to build a Docker container, like a template. Docker images also act as the starting point when using Docker. An image is comparable to a snapshot in virtual machine (VM) environments.

### DockerFile:

A DockerFile is a text file that contains instructions on how to build a docker image. A Dockerfile specifies the operating system that will underlie the container, along with the languages, environmental variables, file locations, network ports, and other components it needs — and what the container will do once we run it.

## The process of containerization your code:

the process of turning your code into a docker container that can run everywhere is called containerization
>  Containerization is OS-based virtualization that creates multiple virtual units in the userspace, known as Containers. Containers share the same host kernel but are isolated from each other through private namespaces and resource control mechanisms at the OS level. geeksforgeeks
>  Containerization is an approach to software development in which an application or service, its dependencies, and its configuration (abstracted as deployment manifest files) are packaged together as a container image. The containerized application can be tested as a unit and deployed as a container image instance to the host operating system (OS). microsoft docs

hard to understand? in simple words containerization is just an approach to collecting all files and tools and configurations that your project needs in one place, a container, and then you can run, deploy, test and delete your container the way you want from any machine that supports docker

you'll ship your code and everything it needs in a container, you execute the code inside this container using a docker image, and the Doker file will contain a series of instructions to specify how to build a docker image.

This is not exactly how things work but I hope you get the main idea!

## Installation:

to install docker on your machine, read this documentation in docker.com
[**Get Docker**](https://docs.docker.com/get-docker/)

on Linux:
[**Install Docker Desktop on Linux**](https://docs.docker.com/desktop/install/linux-install/)

on macOS:
[**Install Docker Desktop on Mac**](https://docs.docker.com/desktop/install/mac-install/)

on Windows:
[**Install Docker Desktop on Windows**](https://docs.docker.com/desktop/install/windows-install/)

## Resources:
[**What is Docker? | AWS**](https://aws.amazon.com/docker/)
[**Docker Tutorial: Get Going From Scratch**](https://stackify.com/docker-tutorial/)
[**Why Should You Use Docker - 7 Major Reasons! - GeeksforGeeks**](https://www.geeksforgeeks.org/why-should-you-use-docker-7-major-reasons/)

Docker vs Kubernetes :
[**Kubernetes vs. Docker: What's the difference?**](https://www.theserverside.com/answer/Kubernetes-vs-Docker-Whats-the-difference)
[**Kubernetes vs Docker: What's the difference?**](https://www.dynatrace.com/news/blog/kubernetes-vs-docker/)
[**Kubernetes vs Docker | Microsoft Azure**](https://azure.microsoft.com/en-us/topic/kubernetes-vs-docker/)
[**Kubernetes Vs Docker | Sumo Logic**](https://www.sumologic.com/blog/kubernetes-vs-docker/)

**Links :**
[**Home - Docker**](https://www.docker.com/)
[**What is Docker?**](https://opensource.com/resources/what-docker)
[**Docker Hub Container Image Library | App Containerization**](https://index.docker.io/)


Thanks for reading, and feel free to ask any question about javascript or this series, I appreciate any feedback to improve My content.

find me on [Twitter](https://twitter.com/Osam1010), [Github](https://github.com/osama865/) and [my portfolio](http://o-portfolio.netlify.com/).