You are on page 1of 74

Presented by:

Mussab , Kiran , Nida , Umal Baneen


SYEDA KIRAN FATIMA

18220856-013
Days before containers

•Different systems used to have different applications


running on it.
•Each application used to have their own operating system.

Reasons to neglect them:


•Unable to judge resource requirements.
•Different infrastructure and dependencies.
VMware

• It is a virtualization and cloud computing service provider.

• A software called hypervisor is used to allow for different virtual machines to run
on single physical server.

• Each machine has it own operating system.


Cont..
Pros:
• Different apps can be run on one server .
• Each vm has its own operating system .
• Save a lot of resources.
Cons:
• There may lot of resources together to handle
• Cost of each operating system
Vmware cont…
Hypervisor

• It is a function that abstracts or arrange operating systems.


• Hypervisor is used by host machine (pysical machine server) to operate
different virtual operating systems as guests.
• By this different guest operating systems can share resources .
Vms vs containers
• In vmware a physical machine has different virtual machines running on it
and they have different operating systems as well and physical machine
uses hypervisor.
• But in containers we have different containers and a single operating
system and each container shares operating system and their resources .
Containers
.
• Containers are a solution to the problem of how to
get software to run reliably when moved from one
computing environment to another.
In containers:
• Single os
• Less resources like cpu ,ram
Different containers

linux:
• linux containers contain applications that keeps them isolated from host
machine or physical server.
• these Containers allow developer to package up an app with its
libraries ,dependencies etc.
• In linux containers we can break down a program into small pieces to
deliver .
cont

Window containers:

• Traditionally containers are operated by linux but they also work on mac
os and windows.

• In this containers is separted from host machine resources like storage and
ram.
NIDA IMTIAZ

18220856-037
What is Docker

• Docker is a tool designed to make it


easier to create, deploy, and run
applications by using containers.
What is Docker

• Docker say that you just containerized your software that it will be
guarantee to run.

• It’s would not be wrong to say that Docker made container simple.
Cont..

• When we say Docker we are talking about the entire ecosystem of Docker
products.

• It includes Docker client, Docker server, Docker hub etc.


Docker Client & Docker Server

• Docker client is a tool we issue commands for reaching out to Docker


server(Daemon)
• The Docker Daemon is a service that runs on your host operating system.
• It is responsible for running Containers.
Container Ecosystem

• The Container Ecosystem provides ways to manage , share, and develop


apps that run in containers.
• Containers allow a developer to package up an application with all of the
parts it needs, such as libraries and other dependencies, and deploy it as
one package.
Difference btw Docker & container

• Docker is a platform that runs each and every application segregated and
securely by the use of kernel containerization feature.
• Docker Image is a set of files which has no state.
•  Docker Container is the instantiation of Docker Image. In other
words, Docker Container is the run time instance of images
Open Container Initiative(OCI)
The Open Container Initiative is a Linux Foundation project to design open
standards for operating-system-level virtualization, most importantly Linux
containers. There are currently two specifications in development and in use:
• Runtime Specification
• Image Specification
Cont..

OCI Image Format Specification


• The OCI Image Format project creates and maintains the software
shipping container image format spec (OCI Image Format
Running an OCI Image
• The Runtime Specification outlines how to run a “file system bundle" that
is unpacked on disk.
Install Docker Ce On Ununtu

1- Update the apt package index 2- install latest version of Docker and containered

>> sudo apt-get update >> sudo apt-get install docker.io


Post installation activities
3- check docker version
>> docker --version

4- check docker info


>> docker info
Continue….
>> docker version
When you install Docker , you get two
major components:

1. Docker Client
2. Docker daemon (server)

• To check if client and server is


working or not by these comands
MUSSAB KIRAN

18220856-012
contents

1. Docker installation 8. Running container


2. Docker engine 9. Stopping container
3. Images 10. Starting container
4. Image registiries 11. Removing container
5. Image naming and tagging 12. Detach mode
6. Image listing 13. Publishing port
7. Removing image 14. Custom container naming
Docker Engine

 The Docker engine is the core software that runs and manages containers

 We often refer it simply as Docker or Docker platform.

 This engine is modular in design with many swapable components.

 The Docker engine is made from many specialized tools that work together to create and
run containers, images, APIs, runtime etc.
Major components

5
Major components….
1. Docker Client:

The Docker client ( docker ) is the primary way that many Docker users interact with Docker. When you
use commands such as docker run , the client sends these commands to dockerd , which carries them out

2. Docker Daemon:

Docker Daemon listens to Docker API request and manages Docker objects such as images, containers,
networks.
3. Container d
Container d act as a bridge between the daemon and runc.
It is responsible for:
 Starting and Stopping Containers.
 Pausing and Un-pausing Containers.
 Destroying the Containers.

4. shim
Shim makes possible to perform maintenance and upgrades on the docker daemon without impacting
docker containers.

5. run c
run c often refer as a container runtime. It has a single purpose in life is to create containers.
Images
 An image is lightweight, standalone, executable packages of software that includes everything needed to
run an application.

 Images are used to create a container. we can create multiple containers from one image that runs as an
instance of an image.
 e.g:-
 Code
 Runtime
 System tools
 System Libraries
 Settings

 Images become containers when they run


on Docker engine
 Inside of the image is a cut-down operating system and all of the files and dependencies required
to run an application.

 In this way, each layer contains different things required to run a containerized app.

 Common layer among different images are downloaded and are stored only once. Then are used
in all images.

 You build container based on images and that is why images are sometimes called stopped
containers.

 you can also create images from actual stopped container.


Images…
□ When a container is up and running made from an image, you can not delete the image until all
container using it has been stopped and destroyed.

□ The whole purpose of container is to run an application.

□ however, containers are all about being fast and lightweight.

□ The extremely small size image example is ; Apline Linux Docker image of 4MB in size.

□ And the size of Ubuntu Docker image is currently 188Mb .


Image registeries
 Docker images are stored in image registries.
 The most common registry is Docker Hub.
https://hub.docker.com

 These registries contains multiple repositories


 Repositories can contain multiple images.
 Consider a house as registery,
having many rooms as repositories
in which many people
can live that is images.
Types of repositories:

1. Offical Repository:
These contains images that have been verified by Docker,inc
e.g. Docker Ubuntu image

2. Unoffical Repository:
common user of docker hub can use it by sign in.
You can pull (download) and push (upload) images from this link:
www.hub.docker.com
Image naming and tagging

□ To Address images from official repo. We have to give repos. Name and tag
seprated by colon (:)

>> docker image pull <repository here> : <tag here>


□ E.g : docker image pull nginx : latest

□ Pulling images from unofficial repos. We also have to add your docker hub username before
repos. Name
>> docker image pull mussab/helloworld:latest

Note: If tag is not written , by default it refers it to latest


Operations
1. Listing Images:

2. Removing images:
Docker containers

□ A container is a runtime instance of an image.

□ From image you create a copy of your app that is up and running.

□ In the same way we can start a virtual machine (VM ) from a virtual machine
templete.

□ The big difference between VM and container is that containers are faster and
light weight.
□ Run in Interective mode:

□ Exit from container:


□ Check container list: (only runing shows)

□ Run same container again:

□ Now press ctrl + PQ (it will not stop container on leaving it)
□ Check all containers:

□ To go to running container:
>> docker exec –it abc sh
Note: Abc is any name & 123 is id that is assigned auto. To container.
□ List running containers:
>> docker container ls
or
>> docker ps

□ List all (running and stoped) containers:


>> docker container ls –a
or
>> docker ps -a
□ How to stop running container abc:
>> docker container stop abc
or
>> docker container stop 123
 
□ How to start the stoped container abc:
>> docker container start abc
or
>> docker container start 123
 
□ How to remove container abc (only in stopped stated):
>> docker container rm abc
or
>> docker container rm 123
Create and Run container from an image in an detach (-d) mode:

>> docker container run –d amirpinger/latest


Publishing image of container:

>> docker container run –d –p 5010:80 amirpinger/helloWorld:latest


Go to google and type url:
>> Localhost:5010
Umal Baneen

18220856-027
Thank You!

You might also like