AWS Global Infrastructure

DevOps

Topics Covered
  • DevOps (92 Blogs)
  • Docker (9 Blogs)
  • DevOps Engineer Masters Program (18 Blogs)
  • Kubernetes (11 Blogs)
SEE MORE

Docker Tutorial – Introduction To Docker

Last updated on Apr 05,2024 140.8K Views

Tanishqa Chaudhary
An intellectual brain with a strong urge to explore different upcoming technologies,... An intellectual brain with a strong urge to explore different upcoming technologies, learn about them, and share knowledge.
4 / 11 Blog from Docker

I hope you haven’t missed the series of earlier DevOps Tutorial blogs. Go through the DevOps Tutorial blog series here. The unstoppable trend of Docker containers is growing, and organizations are looking for professionals possessing Docker Certification TrainingNow this time, we will take you through Docker Tutorial starting with an overview of virtualization and containerization.

Docker Tutorial

This Docker Tutorial blog will provide you with both conceptual and practical knowledge of Docker, a cutting-edge containerization technology.

In this blog, we will focus on the following topics:

Docker is gaining popularity and its usage is spreading like wildfire. The reason for Docker’s growing popularity is the extent to which it can be used in an IT organization. Very few tools out there have the functionality to find itself useful to both developers and as well as system administrators. Docker is one such tool that truly lives up to its promise of Build, Ship and Run.

In simple words, Docker is a software containerization platform, meaning you can build your application, package them along with their dependencies into a container and then these containers can be easily shipped to run on other machines. 

For example: Lets consider a linux based application which has been written both in Ruby and Python. This application requires a specific version of linux, Ruby and Python. In order to avoid any version conflicts on user’s end, a linux docker container can be  created with the required versions of Ruby and Python installed along with the application. Now the end users can use the application easily by running this container without worrying about the dependencies or any version conflicts. 

These containers uses Containerization which can be considered as an evolved version of Virtualization. The same task can also be achieved using Virtual Machines, however it is not very efficient. 

I generally receive a question at this point, i.e. what is the difference between Virtualization and Containerization? These two terms are very similar to each other. So, let me first tell you What is Virtualization?

What is Virtualization?

Virtualization is the technique of importing a Guest operating system on top of a Host operating system. This technique was a revelation at the beginning because it allowed developers to run multiple operating systems in different virtual machines all running on the same host. This eliminated the need for extra hardware resource. The advantages of Virtual Machines or Virtualization are:

  • Multiple operating systems can run on the same machine
  • Maintenance and Recovery were easy in case of failure conditions
  • Total cost of ownership was also less due to the reduced need for infrastructure

Virtual Machine Architecture - Docker Tutorial On Introduction To Docker - Edureka

In the diagram on the right, you can see there is a host operating system on which there are 3 guest operating systems running which is nothing but the virtual machines.

As you know nothing is perfect, Virtualization also has some shortcomings. Running multiple Virtual Machines in the same host operating system leads to performance degradation. This is because of the guest OS running on top of the host OS, which will have its own kernel and set of libraries and dependencies. This takes up a large chunk of system resources, i.e. hard disk, processor and especially RAM.

Another problem with Virtual Machines which uses virtualization is that it takes almost a minute to boot-up. This is very critical in case of real-time applications.

Following are the disadvantages of Virtualization:

  • Running multiple Virtual Machines leads to unstable performance
  • Hypervisors are not as efficient as the host operating system
  • Boot up process is long and takes time

These drawbacks led to the emergence of a new technique called Containerization. Now let me tell you about Containerization.

What is Containerization?

Containerization is the technique of bringing virtualization to the operating system level. While Virtualization brings abstraction to the hardware, Containerization brings abstraction to the operating system. Do note that Containerization is also a type of Virtualization. Containerization is however more efficient because there is no guest OS here and utilizes a host’s operating system, share relevant libraries & resources as and when needed unlike virtual machines. Application specific binaries and libraries of containers run on the host kernel, which makes processing and execution very fast. Even booting-up a container takes only a fraction of a second. Because all the containers share, host operating system and holds only the application related binaries & libraries. They are lightweight and faster than Virtual Machines.

Advantages of Containerization over Virtualization:

  • Containers on the same OS kernel are lighter and smaller
  • Better resource utilization compared to VMs
  • Boot-up process is short and takes few seconds

Container Architecture - Docker Tutorial On Introduction To Docker - Edureka

In the diagram on the right, you can see that there is a host operating system which is shared by all the containers. Containers only contain application specific libraries which are separate for each container and they are faster and do not waste any resources.

All these containers are handled by the containerization layer which is not native to the host operating system. Hence a software is needed, which can enable you to create & run containers on your host operating system.

Check out this Docker tutorial video for a deep understanding of Docker.

Docker Tutorial for Beginners | What is Docker? | DevOps Tools | Edureka

Now, let me take you through the introduction to Docker.

Docker Tutorial – Introduction To Docker 

Docker is a containerization platform that packages your application and all its dependencies together in the form of Containers to ensure that your application works seamlessly in any environment.

Container Apps Using Docker Engine - Docker Tutorial On Introduction To Docker - Edureka

As you can see in the diagram on the right, each application will run on a separate container and will have its own set of libraries and dependencies. This also ensures that there is process level isolation, meaning each application is independent of other applications, giving developers surety that they can build applications that will not interfere with one another.

As a developer, I can build a container which has different applications installed on it and give it to my QA team who will only need to run the container to replicate the developer environment.

 

Docker Tutorial- Benefits of Docker

Now, the QA team need not install all the dependent software and applications to test the code and this helps them save lots of time and energy. This also ensures that the working environment is consistent across all the individuals involved in the process, starting from development to deployment. The number of systems can be scaled up easily and the code can be deployed on them effortlessly.

Docker Tutorial – Features of Docker

  • Docker has the ability to reduce the size of development by providing a smaller footprint of the operating system via containers.
  • With containers, it becomes easier for teams across different units, such as development, QA and Operations to work seamlessly across applications.
  • You can deploy Docker containers anywhere, on any physical and virtual machines and even on the cloud.
  • Since Docker containers are pretty lightweight, they are very easily scalable.

Virtualization vs Containerization

Virtualization and Containerization both let you run multiple operating systems inside a host machine.

Virtualization deals with creating many operating systems in a single host machine. Containerization on the other hand will create multiple containers for every type of application as required.

Virtualization Versus Containerization - What Is Big Data Analytics - EdurekaFigure: What Is Big Data Analytics – Virtualization versus Containerization

As we can see from the image, the major difference is that there are multiple Guest Operating Systems in Virtualization which are absent in Containerization. The best part of Containerization is that it is very lightweight as compared to the heavy virtualization.

Now, let us install Docker.

Docker Tutorial – Install Docker:

I will be installing Docker on my Ubuntu 20.04.1 machine. You can also docker on windows and CentOS. You can follow the below videos to install Docker as per your desired environment.

Docker Installation | Install Docker | Docker Installation In CentOS | DevOps Tools | Edureka

Following are the steps to install Docker on Ubuntu:

  1. Install required Packages
  2. Setup Docker repository
  3. Install Docker On Ubuntu

1. Install Required Packages:

There are certain packages you require in your system for installing Docker. Execute the below command to install those packages.

sudo apt-get install  curl  apt-transport-https ca-certificates software-properties-common

Installing Packages For Docker - Docker Tutorial - Edureka

2. Setup Docker Repository:

Now, import Dockers official GPG key to verify packages signature before installing them with apt-get. Run the below command on terminal:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add

Importing Docker Official GPG Keys - Docker Tutorial - Edureka

Now, add the Docker repository on your Ubuntu system which contains Docker packages including its dependencies, for that execute the below command:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Adding Docker Repository - Docker Tutorial - Edureka

3. Install Docker On Ubuntu:

Now you need to upgrade apt index and install Docker community edition, for that execute the below commands:

sudo apt-get update
sudo apt-get install docker-ce

Upgrade Apt Index - Docker Tutorial - Edureka

Installing Docker - Docker Tutorial - Edureka

Congratulations! You have successfully installed Docker. Also, check out a few commonly used Docker Commands.


Now let us see a few important Docker concepts.

Dockerfile, Docker Image And Docker Container:

  1. A Docker Image is created by the sequence of commands written in a file called as Dockerfile.
  2. When this Dockerfile is executed using a docker command it results in a Docker Image with a name.
  3. When this Image is executed by “docker run” command it will by itself start whatever application or service it must start on its execution.

Docker Hub:

Docker Hub is like GitHub for Docker Images. It is basically a cloud registry where you can find Docker Images uploaded by different communities, also you can develop your own image and upload on Docker Hub, but first, you need to create an account on DockerHub.

Docker Images, Docker Hub, Docker File and Docker Container - Docker Tutorial - Edureka

Docker Tutorial – Docker Architecture:

It consists of a Docker Engine which is a client-server application with three major components:

  1. A server which is a type of long-running program called a daemon process (the docker command).
  2. A REST API which specifies interfaces that programs can use to talk to the daemon and instruct it what to do.
  3. A command line interface (CLI) client (the docker command).
  4. The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands. Many other Docker applications use the underlying API and CLI.

Refer this blog, to read more about Docker Architecture.

Finally in this Docker Tutorial blog I will be talking about Docker Compose.

Docker Compose:

Docker Compose is basically used to run multiple Docker Containers as a single server. Let me give you an example:

Suppose if I have an application which requires WordPress, Maria DB and PHP MyAdmin. I can create one file which would start both the containers as a service without the need to start each one separately. It is really useful especially if you have a microservice architecture.

Refer my blog on Docker Container to understand how to execute it practically.

Also, you can read this blog on how you can containerize a mean stack application using Docker Compose.

With this, we come to an end to Docker Tutorial with an Introduction To Docker & Containerization.

Go through our next blog on Docker: What Is Docker and Docker Containers?

Now that you have understood what is DevOps, check out our DevOps Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. The Edureka DevOps Certification Training course helps learners gain expertise in various DevOps processes and tools such as Puppet, Jenkins, Nagios, Ansible, Chef, Saltstack and GIT for automating multiple steps in SDLC.

Got a question for us? Please mention it in the comments section and we will get back to you.

 

Upcoming Batches For Docker Certification Training Course
Course NameDateDetails
Docker Certification Training Course

Class Starts on 29th March,2025

29th March

SAT&SUN (Weekend Batch)
View Details
Comments
5 Comments
  • Containerization much useful nowadays. A Docker container can now run in Zo/s mainframe in Linux environment. A light weight Docker container is portable and less maintenance.

  • Thanks for the clear explanation.
    In virtualization , we can install different operating systems like
    windows, ubuntu, on top of host OS, but in container is always only one
    host os and we cannot run on different operating system?? Am i correct or wrong??

  • In virtualization , we can install different operating systems like windows, ubuntu, on top of host OS, but in container is always only one host os and we cannot run on different operating system??

    • We are happy to have helped, Jeevan. Do check out our other blogs on the various tools used for DevOps, you will definitely find it interesting! :)

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

Docker Tutorial – Introduction To Docker

edureka.co