Getting Started with Docker

Using Virtualization.

If we want to perform any application on the operating system then we require RAM, a processing unit (CPU) and also Storage to store our data. Suppose if we want to run a program in another operating system, so we have to install another operating system on the Bare-Metal. Bare-Metal refers to the installation of our operating system at the top of hardware. An operating system that operates on top of hardware requires a lot of time for installation, thus there is a lot of delay or latency that we are observing. Let’s start off by comparing our house with the operating system. When we want to watch the TV we immediately go to that room in our house where the TV is, this is exactly what we do with Virtualization. Instead of destroying and installing different OS at the top of Bare-Metal we create different Virtual Machines at the top of our operating system and then according to our requirement of the program that we want to run, we start the required Virtual Machine.

We use VirtualBox, a tool that helps us to install multiple Virtual Machines on the top of our operating system.

Link for the Virtualbox and ISO file for Red Hat Enterprise Linux-8 :

If we want to install an operating system as Bare-Metal, we use a bootable DVD for installation. The same is the case for launching a Virtual machine. If we want to create a Linux VM, then we need an `ISO` file to create our machine, this `ISO` can be understood by easily comparing it with the bootable DVD. `ISO` stands for International Organization for Standardization. An ISO file is an uncompressed disk image file format use to make the complete image of an optical disk.

What is Docker ?

Now go back to comparing your house to the operating system. Visualize that each room is a Virtual Machine. To create and destroy a Virtual Machine takes far less time than installing Bare-Metal, but still it cannot solve the issue of latency, there is still some lag. Virtual Machine shares the RAM from the Base operating system itself, so it is clear to say that every time we create a new Virtual Machine, when we run it, the RAM has been occupied from our Base system. To overcome this issue again, we use Docker container technology on top of our Virtualization. Take the kitchen in your house for example, each container in the kitchen is a new operating system. Every container has its own set of RAM and storage that is borrowed from the Virtual Machine. So, imagine it this way, every container uses or shares the RAM and storage borrowed from the Virtual Machine which in turns borrows from the Base system.

Look at this image to get a better understanding of how Docker works:

Docker working
Docker working

In the above image we can see how the whole architecture of Docker and how it works.
For installation of Docker visit :

https://linuxconfig.org/how-to-install-docker-in-rhel-8

Docker Hub provides an immense variety of container images, we can install Linux, Windows and even Mac OS with a variety of other tools in our container. After installing docker we have to start docker services by typing this command in our terminal:

systemctl start docker
docker images

The above command shows all the images that are installed. Let’s install a Centos image :

docker pull centos:latest

Centos is the OS name and latest is the version name, we can also choose a version of centos.

VM
VM

After our OS installs, it’s time to run our operating system in the container. For running the container type the command :

docker run -i -t --name Myos centos:latest
  • -i : This command is used because we want our terminal to be interactive.
  • -t : This is used as we want terminal for our container.
  • –name : This command gives a name to our container, here Myos.

Now we are inside our Centos terminal. “docker” command is only supported in our Red Hat Linux, so if we try to run docker in this terminal the command won’t work.

To exit our current Centos terminal we simply type ‘exit

We can perform multiple operations in our container and we can launch more than a single container at any point of time. When our requirement is satisfied, we can terminate our container at any time.

To see the status of our containers we use :

docker ps -l

This command lists all the containers that are currently running or terminated.

That’s it, this is how we use Docker to create multiple OS environments, and we can launch or terminate any OS in 1 sec. Using Docker not only reduces latency but less RAM is also occupied by containers.

This was an overview on Getting started with Docker.
Hope you find this useful!

Thank you for Reading!



Categories: Docker

Tags: , , , ,

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: