Docker
Docker
Hypervisor
It’s a piece of software or firmware that create and run virtual machine.
A hypervisor is also called a virtual machine manager (VMM).
Hypervisor Type-2
Type 2 Hypervisors
While a Type 1 hypervisor runs directly on the host computer’s physical hardware, a Type 2
hypervisor runs as a software layer on top of the operating system of the host computer.
Robust Type 2 hypervisors typically provide:
An easy setup process, as they do not require separate management machines.
Streamlined access to a guest OS alongside the primary OS the host computer runs on,
which makes them ideal for end-user productivity.
Additional toolkits for users to install into the guest OS, which provides enhanced
connections between the guest and the host OS.
However, Type 2 hypervisors are not as secure or efficient as Type 1 due to their deployment.
Because communication between a Type 2 hypervisor and the host’s hardware must pass
through the OS layer, issues such as latency, or a delay in processing requests, can occur.
Examples of Type 2 Hypervisors
Common examples of Type 2 hypervisors include:
Microsoft Virtual PC.
Oracle Virtual Box.
VMware Workstation.
Oracle Solaris Zones.
VMware Fusion.
Oracle VM Server for x86.
CentOS Virtualization.
The Benefits of Hypervisors
Both Type 1 and Type 2 hypervisors feature many benefits, including:
Efficiency: VMs can be created instantly using hypervisors, which provides organizations
with higher accuracy and efficiency when allocating resources for complex workloads.
Adaptability: Type 1 hypervisors allow guest operating systems and their applications to
run on multiple different hardware types, rather than relying on OS-specific devices or
drivers. This is because a hypervisor separates each guest OS from the host computer’s
hardware.
Agility: The agility of hypervisors is primarily due to their ability to run multiple VMs
using one host computer’s resources—but they also provide agile utilization of physical
servers. For example, a hypervisor provides a more cost-efficient way to run multiple
VMs, rather than using multiple servers to complete the same task.
Moveability: VMs in hypervisor software are isolated from the physical host computer,
which means they can be moved across multiple servers, if needed. This means IT teams
can easily and seamlessly manoeuvre changing workloads to different localized or
remote virtual servers that feature the required networking, memory, storage, or
processing capabilities.
The Drawbacks of Hypervisors
While an amazing technology, there are a few concerns with hypervisor environments compared
to traditional dedicated servers.
Resource Overhead: Because hypervisors are the managers of their virtual servers, some
of the resources of the physical server will be used by the hypervisor, so the virtual
servers will not be able to use 100 percent of the resources of the physical servers.
Learning Curve: Managing servers in a virtual environment is different from a traditional
environment, as you need to learn how to use the hypervisor itself to manage the virtual
servers. This can mean additional training for some technicians.
Additional Security Concerns: Every piece of hardware and software on your server
represents a possible attack vector for hackers. Adding virtualization can therefore add
security risk through additional attack surface(s).
Hypervisor Type 1 vs. Type 2 in Tabular Form
Hypervisors Containers
Hypervisors vs Containers
Docker
Docker Container is like virtual machine
Testing
Dev Ops
Development Production
Operation
1] Consistent & Isolated environment create container in isolated manner means each container
have its own OS/tools/development, no container depends on other container. One can create
image of container and share it to another container or other sever or testing team/production
team etc.
2] Rapid Application development take low memory
3] Ensure scalability/flexibility
4] Better potability
5] Cost effective
6] Built in version control system
7] Security
Resource[hdd, ram, CPU] will consume only when container is in working mode, no container
use the H/W & os while they are free or not working.
Docker is an open-source centralized platform designed to create, deploy and run
application.
Docker user container on host OS to run applications. At allows applications to use the
same Linux kernel as a system on the host computer rather then creating a whole virtual
OS
We can install docker on any OS but docker Engine run natively on Linux distribution
Docker written in Go language.
Docker is a tool that preforms OS level virtualization also known as containerization.
Before docker many users face the problem that a particular code is running in the
developer system. But not in the user system.
Docker was first release in march. 2013, its design by Solomon hyper
Docker is a set of platforms provide service on user OS level virtualization whereas
VMware use the Hardware level Virtualization
Docker engine fetch the image from docker hub and install it into container.
Docker engine take 95% of OS from main OS and 5% it will take from docker hub, because all
Linux system have same base-Unix
Even at will share all the H/W resource from main OS.
So container contain any 5% of light weight OS
Advantages
No pre allocation of RAM
CI- efficiency – Docker
enable you to build a container image and use that same image across every step
of the development process
Less cost
It’s light weight
It can run on physical H/W virtual H/W or on cloud
you can reuse the image
It took very less time to create container.
Note: We never share container we always share image.
Disadvantage
No solution for data recovery & backup
Not a cross platform.
Docker is not a good solution for application require rich UI good for CLI
Difficult to manage large amount of container
Docker is suitable when the development OS and testing OS are same if the OS is
different, we should use VM
Architecture of Docker
It contains dependencies
1] when we execute Docker file on Docker Engine It will create image and save it and when we
can create container & install image in it.
2] upload image on Docker hub
Component of Docker
Docker Daemon
Docker daemon runs on the host OS.
It is responsible for running container to manage Docker service
Docker Daemon can communicate with another daemon.
Docker client
Docker user can interact with Docker through a client
Docker client uses commands with Docker daemon.
When a client runs any server command on the Docker client terminal it send the Docker
command to the docker daemon
It is possible for docker Client to communicate with more than are one daemon
Docker host
Docker host is used to provide an environment to execute & run application. It contains Docker
daemon, images, containers, network & storage
Docker Images
Docker images are the read only binary templates use to create Docker container.
or
Single file with all the dependencies & configuration, required to run a program.
Docker container
Container hold the entire package that is needed to run the application
OR
In other words, we can say that, the images is a template and the container is a copy of that
template.
Container is like a virtual machine.
Images becomes container when they run on Docker Engine.
Update Linux
yum install -y
Install Docker
yum install docker -y
To check the docker version
docker -v
or
docker –version
ENV
To set Environment name of container
ENTRYPOINT
Similar to CMD but has higher priority then CMD, first command will be execute by
ENTRYPOINT only
To create Script
Create a file using
vi Dockerfile
and write following command
FROM ubuntu
RUN echo “this is my first docker script” > data.txt
To run Docker file script
Docker build -t <image name> .
Volumes in Docker
Volumes(folder) shared by all the containers.
If container remove volume never delete.
Two types of sharing
- Container to container
- Host to Container
Properties of volume
- Volume is simply directory inside container
- Firstly, we have to declare the volume and then share the volume
- Even we stop the container, still we can access the volume
- Volume will be created in any one container and further it shared by
Another container.
Running Container
Volume
Volume
Container Container
One Two
Benefits of Volume
docker login
it will ask username and password
- Tag the image which you want to upload on docker hub
Container
HTTP 80 SSH 22
Response Request