DEV Community

Cover image for Docker: Brief Introduction.
Osama
Osama

Posted on

Docker: Brief Introduction.

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)

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

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

in nutshell :

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

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)

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

on Linux:
Install Docker Desktop on Linux

on macOS:
Install Docker Desktop on Mac

on Windows:
Install Docker Desktop on Windows

Resources:

What is Docker? | AWS
Docker Tutorial: Get Going From Scratch
Why Should You Use Docker - 7 Major Reasons! - GeeksforGeeks

Docker vs Kubernetes :
Kubernetes vs. Docker: What's the difference?
Kubernetes vs Docker: What's the difference?
Kubernetes vs Docker | Microsoft Azure
Kubernetes Vs Docker | Sumo Logic

Links :
Home - Docker
What is Docker?
Docker Hub Container Image Library | App Containerization

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, Github and my portfolio.

Top comments (1)

Collapse
 
frankrsc profile image
Francisco Flores

Hi, i have a question, if i want to do a microservices project, i only need to dockerize the microservices and a db or putt all the containers in a container?