0% found this document useful (0 votes)
23 views

18ce005 Practical 9

Dk r rrrrrree in the city of the south korea vs england vs england live match today in the world cup

Uploaded by

Jay Sardar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

18ce005 Practical 9

Dk r rrrrrree in the city of the south korea vs england vs england live match today in the world cup

Uploaded by

Jay Sardar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

CE443 Cloud Computing 18CE005

PRACTICAL 9
Aim: Implementing Container based virtualization using Docker and perform basic commands
and transfer file from host machine to container and container to host Also change the name of
containers
Software Requirement: Docker
Theory:
o Docker
• Docker is the containerization platform which is used to package your application
and all its dependencies together in the form of containers so to make sure that
your application works seamlessly in any environment which can be
development or test or production. Docker is a tool designed to make it easier to
create, deploy, run applications by using containers.
o Containerization
• Containerization is OS-based virtualization which 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. Container-based Virtualization provides a different
level of abstraction in terms of virtualization and isolation when compared with
hypervisors. Hypervisors use lot of hardware which results in overhead in terms
of virtualizing hardware and virtual device drivers. A full operating-system (e.g -
Linux, Windows) run on top of this virtualized hardware in each virtual machine
instance.
• But in contrast, containers implement isolation of processes at the operating
system level, thus avoiding such overhead. These containers run on top of the
same shared operating system kernel of the underlying host machine and one or
more processes can be run within each container. In containers you don’t have to
pre-allocate any RAM, it is allocated dynamically during creation of containers
while in VM’s you need to first pre-allocate the memory and then create the
virtual machine. Containerization has better resource utilization compared to
VMs and short boot-up process. It is the next evolution in virtualization.
• Containers are able to run virtually anywhere, greatly easy development and
deployment: on Linux, Windows, and Mac operating systems; on virtual
machines or bare metal, on a developer’s machine or in data centers on-
premises; and of course, in the public cloud. Containers virtualize CPU,
memory, storage and network resources at the OS-level, providing developers
with a sandboxed view of the OS logically isolated from other applications.
Docker is the most popular open-source container format available and is
supported on Google Cloud Platform and by Google Kubernetes Engine.

CSPIT(CE) 1
CE443 Cloud Computing 18CE082

o Docker Architecture
• Docker architecture consists of Docker client, Docker Daemon running on Docker
Host and Docker Hub repository. Docker has client-server architecture in which
client communicates with the Docker Daemon running on the Docker Host using
combination of REST API’s, Socket IO and TCP. If we have to build the Docker
image, then we use the client to execute build command to Docker Daemon then
Docker Daemon build an image based on given inputs and save into Docker
registry. If you don’t want to create an image then just execute the pull command
from the client and then Docker Daemon will pull the image from the Docker
Hub and finally if we want to run the image then execute the run command from
the client which will create the container.

o Components of Docker
• The main components of Docker include – Docker clients and servers, Docker
images, Docker file, Docker Registries and Docker containers. These
components are explained in details in the below section:
1. Docker Clients and Servers– Docker has a client-server architecture. The
Docker Daemon/Server consists of all containers. The Docker
Daemon/Server receives the request from the Docker client through CLI or
REST API’s and thus process the request accordingly. Docker client and
Daemon can be present on the same host or different host.

2. Docker Images– Docker images are used to build docker containers by


using a read-only template. The foundation of every image is a base image
for eg. base images such as- ubuntu14.04 LTS, Fedora 20. Base images can

CSPIT(CE) 2
CE443 Cloud Computing 18CE082

also be created from scratch and then required applications can be added to
the base image by modifying it thus this process of creating a new image is
called “committing the change”.
3. Docker File– Dockerfile is a text file that contains a series of instructions on
how to build your Docker image. This image contains all the project code
and its dependencies. The same Docker image can be used to spin ‘n’
number of containers each with modification to the underlying image. The
final image can be uploaded to Docker Hub and share among various
collaborators for testing and deployment. The set of commands that you need
to use in your Docker File are FROM, CMD, ENTRYPOINT, VOLUME,
ENV and many more.
4. Docker Registries– Docker Registry is a storage component for Docker
images. We can store the images in either public/private repositories so that
multiple users can collaborate in building the application. Docker Hub is
Docker’s own cloud repository. Docker Hub is called a public registry where
everyone can pull available images and push their own images without
creating an image from scratch.
5. Docker Containers– Docker Containers are runtime instance of Docker
image. Containers contain the whole kit required for an application, so the
application can be run in an isolated way. For eg.- Suppose there is an image
of Ubuntu OS with NGINX SERVER when this image is run with docker
run command, then a container will be created and NGINX SERVER will be
running on Ubuntu OS.

Implementation:
o Step 1:
• Go to docker.com
• Once you get home page click on get started

CSPIT(CE) 3
CE443 Cloud Computing 18CE082

• On the next screen select docker desktop

• After installation you will notice docker icon on the desktop. Click on the bottom
of your menu bar [ if you are running on Mac it shows on top corner]

CSPIT(CE) 4
CE443 Cloud Computing 18CE082

• No container, because we haven’t pushed any images


• Next to click on docker hub

o Step 2:
• It will take on docker hub home page. It’s an open-source averment. So, subscribe
on it. It is primary place where you can upload/download the images and its central
repository.

• Let’s go back to docker hub page [ below shows public images]

CSPIT(CE) 5
CE443 Cloud Computing 18CE082

• Pull an Ubuntu Image

• Open windows powershell ISE where you can to paste the above image [to check
its working or not run docker images command]

CSPIT(CE) 6
CE443 Cloud Computing 18CE082

• Now run ubuntu image in a container


Run the following command [ -it stand as interactive mode]
1. docker run -it ubuntu

2. now run docker ps

• Note: no port value coz its just an operating system run container [not running
application server or web server or any specific application]
• Last column shows container name you can change it later on too or while
running command

• Explore essential docker command


1. Retrieving ubuntu container id
docker ps -aqf "name=ubuntu"

2. Check the statistics of container

CSPIT(CE) 7
CE443 Cloud Computing 18CE082

docker stats $(docker ps -aqf "name=ubuntu")

• As you see CPU utilization is negligible

3. Top processor that are currently running in container

4. Port on which process running.

Conclusion: From this practical I learned about docker and implementation of Container
based virtualization using Docker.

CSPIT(CE) 8

You might also like