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

Docker

Containers allow applications and their dependencies to be bundled into lightweight, portable packages called images that can run on any infrastructure regardless of the underlying operating system. Docker is a popular containerization platform that packages applications into containers that can be easily deployed. It provides operating-system-level virtualization with resource isolation and allocation to bundle applications and their dependencies into portable images.

Uploaded by

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

Docker

Containers allow applications and their dependencies to be bundled into lightweight, portable packages called images that can run on any infrastructure regardless of the underlying operating system. Docker is a popular containerization platform that packages applications into containers that can be easily deployed. It provides operating-system-level virtualization with resource isolation and allocation to bundle applications and their dependencies into portable images.

Uploaded by

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

2/1/2023

Containers

What is Container?
Containers
• Operating-System-Level Virtualization
• Allows to run multi-tenant user space instances within a different
context than that of the host Operating System
– Allow us to be able to create “images” of an application runtime and
then run one or many “instances” of that image on our systems
– Even if the Host does not have the required software installed to
actually run the application inside the image
– The requirements are shipped along with the Image

1
2/1/2023

What is Container?
Containers
• Operating-System-Level Virtualization

What is Container?
• Containers is a lightweight virtualization technology acting
as an alternative to hypervisor virtualization
– Bundle any application in a container and run it without
thinking of dependencies, libraries, and binaries
– All containers share the same host operating system
– Multiple containers get created for every type of application
making them faster but without wasting the resources

2
2/1/2023

What is Container?
• Supports multiple containers with different application
requirements and dependencies to run on the same host
– As long as they have the same operating system requirements

Before Container
The problem
• Assume three different Python-based applications that needs
to be hosted on a single server (which could either be a
physical or a virtual machine)
– Each of these applications makes use of a different version of
Python, as well as the associated libraries and dependencies, differ
from one application to another
– Since we cannot have different versions of Python installed on the
same machine
• This prevents us from hosting all three applications on the same
computer

3
2/1/2023

Before Docker
The Solution
• Three physical machines, or a single physical machine,
which is powerful enough to host and run three virtual
machines on it
• Both the options would allow us to install different versions
of Python on each of these machines, along with their
associated dependencies

Virtual Machines Vs Container


• A VM is an abstraction of a machine (from its physical hardware)
• We can run multiple VMs in a single physical machines using a
special kind of program called a hypervisor
– Multiple hypervisors in the market: like VirtualBox, or Vmware, hyper-V
• Each VM can run its own software (even the OS)

4
2/1/2023

Virtual Machines Vs Container

Virtual Machines Vs Container


• Problems with VMs are that:
– Each VM needs its own OS
– Slow to start
– Resource intensive (each VM takes up a slice of the hardware)
• A container is an isolated environment for running an
application, just as a VM. Differences are that
– All share the OS of the host and are therefore, more lightweight
– Start up very quickly
– Use up less hardware resources

5
2/1/2023

What is 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
• Docker is a software platform that simplifies the process of
building, running, managing and distributing applications
– It does this by virtualizing the operating system of the computer on
which it is installed and running

What is Docker?
• A Docker Container have a virtual copy of the process table,
network interface(s), and the file system mount point(s)
– These have been inherited from the operating system of the host
on which the container is hosted and running
– Whereas the kernel of the host’s operating system is shared
across all the containers that are running on it
– This allows each container to be isolated from the other present
on the same host

6
2/1/2023

Core Components of Docker


Docker Engine

Core Components of Docker


Docker Engine
• Responsible for the overall functioning of the Docker platform
• A client-server based application and consists of 3 main
components
– Server – Docker daemon
– REST API
– Client – Docker CLI

7
2/1/2023

Core Components of Docker


Docker Engine
• The Server runs a daemon known as dockerd (Docker
Daemon), which is nothing but a process
– Responsible for creating and managing Docker Images,
Containers, Networks and Volumes on the Docker platform

• The REST API specifies how the applications can interact with
the Server, and instruct it to get their job done
• The Client is nothing but a command line interface, that
allows users to interact with Docker using the commands

Docker Architecture

8
2/1/2023

Docker Architecture

Docker Architecture
Docker Image
• A recipe/template that contains the application, and all the
dependencies required to run that application on Docker
Docker Container
• A running instance of the Docker Image
Docker Registry
• A repository for Docker images which is used for creating
Docker containers
• We can use a local/private registry or the Docker hub,
which is the most popular social example of a Docker
repository

9
2/1/2023

What is Docker Hub?


• Docker Hub is the official online repository where you could
find all the Docker Images that are available to use
• Docker Hub also allows us to store and distribute our custom
images as well if we wish to do so
– We could also make them either public or private, based on our
requirements

Docker Editions
• Docker is available in 2 different editions, as listed below:
– Community Edition (CE)
– Enterprise Edition (EE)

• The Community Edition is suitable for individual developers


and small teams. It offers limited functionality, in comparison
to the Enterprise Edition
• The Enterprise Edition, on the other hand, is suitable for large
teams and for using Docker in production environments

10
2/1/2023

Installing Docker

https://docs.docker.com

Docker Commands
docker create
• Allows us to create a new container
docker create IMAGE
Example
$ docker create mysql

• If the container was created successfully, Docker will return


the container ID

11
2/1/2023

Docker Commands
docker ps
• Allows us to view all the containers that are running on the
Docker Host
$ docker ps

$ docker ps –a
• Display all the containers that were created on this Docker
Host - running or exited

Docker Commands
docker start
• Starts any stopped container(s)
docker start CONTAINER ID/NAME
Example
$ docker start 30986
docker stop
• Stops any running container(s)
docker stop CONTAINER ID/NAME
Example
$ docker start 30986

12
2/1/2023

Docker Commands
docker run
• First creates the container, and then it starts the
container
• In short, this command is a combination of the docker
create and the docker start command
docker run IMAGE [commands] [arguments]
Example
$ docker run ubuntu

Docker Commands
docker rm
• If we want to delete a container, we use the docker
rm command
docker rm CONTAINER ID/NAME

docker images
• Lists out all the Docker Images that are present on
your Docker Host
$ docker images

13
2/1/2023

Docker Commands

docker rmi
• Allows us to remove an image(s) from the Docker Host

docker rmi IMAGE NAME/ID

14

You might also like