Mastering Docker: Unleash the Full Potential of Containerization, Part-1:

"Everything you need to know about Docker".

·

6 min read

Mastering Docker: Unleash the Full Potential of Containerization, Part-1:

Introduction:

Hey there, Am Vishwa! DevOps and OpenSource Enthusiast. Currently learning Docker with the help of OpenSource resources. Here am going to share the concepts which I learned till now. Let's start exploring it.

Before Docker:

Initially, one application runs on one server, every time we want to run a new application we need to buy a new server.

Who solves this problem and How?

VMware, by using Virtual Machines. In simple terms, we can run multiple applications on a single server. Another problem here is, the VM needs its OS but it is far better than running one application on one server and also it was still not perfect.

What problem does it solve?

1. It works on my machine issue, i.e. Dependency management.
2. While shifting code from one to another, migration might also be time-consuming.
3. When we want to set up an OpenSource project locally, by using Docker we can do that very easily.

Containers:

- It is a way to package applications with all the necessary dependencies and configurations.

- Portable artifact, easily sharable and moved and It makes development and deployment more efficient.

- The main problem it solves is we can run thousands of applications on a single VM that contains only one OS rather than having multiple OSs, dedicated resources etc.

Where do Containers live?

- The answer is in Container repositories.

- Private repositories for Organisations and Public repositories for Docker i.e.) Docker Hub.

Virtual Machine vs Containerization:

1. VM uses more resources to run a lightweight application whereas Container always consumes very less amount of resources.
2. While copying the same VMs, it will create a guest OS for each copy whereas while using Container we don't want to worry about guest OS.

Hypervisor is used to create multiple OS in the Host OS and manages VMs.

Docker vs Virtual Machine - What are the key differences? - techieswiki

Note: One of the main advantages is the remaining resources act as a shared memory for all the processes that are running and also when some of the containers are not utilizing the CPU or Memory, the shared resources are used by other containers running within the Hardware.

What is Docker?

- It is a container platform that helps us to build, deploy, test, scaling & manage apps.
1. For Mac/Windows: We use Docker Desktop,
2. For Linux: We use Docker Engine.

- Docker Desktop, Docker Engine, Docker Compose and Docker Hub are the major things in this Containerization technology.

What is Docker Desktop?

- It is nothing but which provides a user-friendly interface that simplifies the process of creating and managing containers.

What is Docker Engine?

- It exposes a command-line interface (CLI), which allows users to interact with and control Docker containers. The CLI provides a set of commands for managing containers, images, networks, and other Docker-related operations.

- Also it provides Docker Runtime that allows us to start/stop the containers

What is Docker Compose?

- It is a YAML/JSON file that has all the docker run commands which are used to run multiple containers.

- The best part is we don't want to create a network for the containers to talk to each other, docker-compose will take care of creating a common network.
(Will see about Docker Networking in the later part)

What is Docker Hub?

- It is nothing but an online docker image registry that is free to all. It contains many docker images for various applications.

What is Container Image?

- Basically, Container Image is nothing but a file that contains all the instructions and everything.

- If I want to run my application in my friend's system, I'll create an Image of it then I'll share it with my friend and they will run it on their system.

- Technically, It is layers of Image.

Layers:

- It is nothing but Images are built in layers.

- One image is downloaded already if another image also uses several files that are already downloaded along with the previous image then those files won't be downloaded again.

Docker Images. Container images are templates from… | by saurabh goyal |  Medium

What is Docker File?

- It is nothing but if we want to containerize our app, we write a docker file first then it will be converted as an Image then it will be shared with others.

The Architecture of a Container:

- It is a three-step process when doing anything related to Container.

Docker Objects. Dockerfile | by Bikram | Medium

Difference between Docker File and Docker Image:

- Docker File is nothing that contains the list of instructions whereas Docker Image has files, OS and dependencies available are mentioned here.

Difference between Docker Image and Docker Container:

- Image is an actual package that contains the application, config files, and dependencies whereas Container is used to start the application.

- Image is an Artifact that can be moved/shared around whereas here Container environment is created.

- Image will not run but Container does.

How Containers improved development process:

Before Containers:

- The installation process differs on each OS environment.

- In several cases, many steps where something could go wrong.

User Migration: The Definitive Guide | Okta Developer

After Containers:

- Don't have to install any of the services directly on your local system.

- Container has its isolated environment.

- Packaged with all the needed configuration files.

- One command to install the application.

- We can run the same application with two different versions.

Happy Smiling Man Or Businessman Working On Computer In Office Vector  Cartoon Stick Figure Illustration Stock Illustration - Download Image Now -  iStock

How Containers improved deployment process:

Before Containers:

- The development team will produce some artifacts along with instructions to install and configure those on the server.

- The operation team will handle the server for the deployment.

Now the problem is,

1. Configuration on the server is needed (Dependency version conflicts),
2. Textual guide to deployment, Misunderstandings like either the Dev team forgot to mention some instructions or the Ops team will mis-interrupt those instructions.

After Containers:

- The Dev and Ops teams will work together to package the application in a container.

- No environment configurations are needed on the server except Docker Runtime.

Software Development Team Work, HD Png Download , Transparent Png Image -  PNGitem

Conclusion:

That's it for now folks, will see How Docker CLI works, Various Docker commands, Accessing a Container locally, How to Create Docker Images, Container Port vs Host Port, Debugging Containers, Docker Networking, How to create Docker Compose files, What is Docker private registry and about Docker Volumes in the upcoming part.

Thanks for the read guys, Do share it with your friends and show your support.

Did you find this article valuable?

Support VISHWA S's blog by becoming a sponsor. Any amount is appreciated!