Vitual Systems and Services
Lec # 11
Docker
Government College University, Faisalabad
BS IT 6th Semester
15/09/2024
Prepared by:
Gul Farheen Ulfat
Introduction
• Docker is a containerization technology that enables developers to package a service into a
container along with its dependencies, libraries and operating system.
• By separating the apps from the infrastructure, Docker allows you to seamlessly deploy and
move apps across a variety of environments.
• Docker makes it very simple to create and manage containers using the following steps
Create a Docker file and add the code
Build a Docker image based on the Dockerfile
Create a running instance from the Docker image
Scale containers on-demand
Containers
• A container is a notable use case of microservices architecture.
• A container is a standard unit of software that isolates an application
from its underlying infrastructure by packaging it with all dependencies
and required resources.
• Unlike virtual machines, which virtualize hardware layers, containers
only virtualize software layers above the OS level.
• Docker has become synonymous with containerization because of its portability and
ecosystem.
• All major cloud providers such as AWS, GCP and Azure have incorporated Docker into the
system and also provide support.
• Therefore, you can seamlessly run Docker containers on any environment including
VirtualBox, Rackspace andOpenStack. Scalability is one of the biggest benefits of Docker.
• By deploying multiple containers on a single host, organizations can significantly reduce
operational costs. Moreover, Docker allows you to deploy services on commodity
hardware thus eliminating the costs of purchasing expensive servers.
Benefits of Containers
• Portability: Containers encapsulate all dependencies, making it easy to
run the same containerized application across various environments
(e.g., development, staging, production) without compatibility issues.
• Isolation: Containers provide process and file system isolation,
ensuring that applications do not interfere with each other.
• Efficiency: Containers use fewer resources than virtual machines
because they share the host operating system's kernel rather than
running their own OS.
Architecture of Docker
• Docker makes use of a client-server architecture. The Docker
client talks with the docker daemon which helps in building,
running, and distributing the docker containers.
• The Docker client runs with the daemon on the same system or
we can connect the Docker client with the Docker daemon
remotely.
• With the help of REST API over a UNIX socket or a network, the
docker client and daemon interact with each other.
Docker Daemon
•Docker daemon manages all the services by
communicating with other daemons.
•It manages docker objects such as images, containers,
networks, and volumes with the help of the API
requests of Docker.
Docker Client
• With the help of the docker client, the docker users can interact with the docker. The docker
command uses the Docker API.
• The Docker client can communicate with multiple daemons. When a docker client runs any docker
command on the docker terminal then the terminal sends instructions to the daemon. The Docker
daemon gets those instructions from the docker client withinside the shape of the command and
REST API’s request.
• The main objective of the docker client is to provide a way to direct the pull of images from the
docker registry and run them on the docker host.
• The common commands which are used by clients are docker build, docker pull, and docker run
Docker Host
•A Docker host is a type of machine that is
responsible for running more than one
container.
•It comprises the Docker daemon, Images,
Containers, Networks, and Storage.
Docker Registery
• All the docker images are stored in the docker registry. There is a public
registry which is known as a docker hub that can be used by anyone.
• We can run our private registry also. With the help of docker run or
docker pull commands, we can pull the required images from our
configured registry.
• Images are pushed into configured registry with the help of the docker
push command.
Docker Objects
Whenever we are using a
docker, we are creating and
use images, containers,
volumes, networks, and
other objects. Now, we are
going to discuss docker
objects:-
Docker Images
• An image contains instructions for creating a docker
container. It is just a read-only template.
• It is used to store and ship applications. Images are an
important part of the docker experience as they enable
collaboration between developers in any way which is not
possible earlier.
Docker Containers
• Containers are created from docker images as they are ready
applications. With the help of Docker API or CLI, we can start,
stop, delete, or move a container.
• A container can access only those resources which are defined in
the image unless additional access is defined during the building
of an image in the container.
Docker Storage
• We can store data within the writable layer of the container but it requires a
storage driver. Storage driver controls and manages the images and containers
on our docker host.
Types of Docker Storage
• Data Volumes: Data Volumes can be mounted directly into the filesystem of the container and
are essentially directories or files on the Docker Host filesystem.
• Volume Container: In order to maintain the state of the containers (data) produced by the
running container, Docker volumes file systems are mounted on Docker containers. independent
container life cycle, the volumes are stored on the host. This makes it simple for users to
exchange file systems among containers and backup data.
• Directory Mounts: A host directory that is mounted as a volume in your container might be
specified.
• Storage Plugins: Docker volume plugins enable us to integrate the Docker containers with
external volumes like Amazon EBS by this we can maintain the state of the container.
Docker Networking
• Docker networking provides complete isolation for docker containers. It means a user can link a
docker container to many networks. It requires very less OS instances to run the workload.
• Types of Docker Network
• Bridge: It is the default network driver. We can use this when different containers communicate
with the same docker host.
• Host: When you don’t need any isolation between the container and host then it is used.
• Overlay: For communication with each other, it will enable the swarm services.
• None: It disables all networking.
• macvlan: This network assigns MAC(Media Access control) address to the containers which look like
a physical address
• Docker’s underlying motto includes fewer resources and smaller engineering teams.
• Organizations can therefore perform operations using fewer resources and thereby
require less staff to monitor and manage such operations. This means cost savings
and more ROI.
• Docker allows you to instantly create and manage containers with ease, which
facilitates faster deployments.
• The ability to deploy and scale infrastructure using a simple YAML config file
makes it easy to use all while offering a faster time to market. Security is
prioritized with each isolated container.
Popular Container Management Tools
Kubernetes
• Kubernetes is the most popular container management tool developed by Google.
It wasn’t long before Kubernetes became a de facto standard for container
management and orchestration.
• Google moved the tool to Cloud Native Computing Foundation (CNCF), which
means the tool is now supported by industry giants such as IBM, Microsoft,
Google andRedHat.
• It enables you to quickly package, test, deploy and manage large clusters of
containers with ease. It’s also open-source, cost-effective and cloud-agnostic.
Amazon EKS
• As Kubernetes became a standard for container management cloud
providers started to incorporate it into their platform offerings.
• Amazon Elastic Kubernetes Service (EKS) is a managed Kubernetes
service for managing Kubernetes on AWS. With EKS organizations don’t
need to install and configure Kubernetes work nodes or planes seeing as
it handles that for you.
• In a nutshell, EKS acts as a container service and manages container
orchestration for you. However, EKS only works with AWS cloud.
Amazon ECS
• Amazon Elastic Container Service (ECS) is a fully managed container management tool for
AWS environments which helps organizations manage microservices and batch jobs with
ease.
• ECS looks similar to EKS but differs seeing as it manages container clusters, unlike EKS
which only performs Kubernetes tasks. ECS is free while EKS charges $0.1 per hour. That
said, seeing as it’s open-source, EKS provides you with more support from the community.
• ECS, on the other hand, is more of a proprietary tool. ECS is mostly useful for people who
don’t have extensive DevOps resources or who find Kubernetes to be complex.
Azure Kubernetes Service
• Azure Kubernetes Service (AKS) a container management tool that is a fully-
managed Kubernetes service offered by Microsoft for Azure environments.
• It’s open-source and mostly free seeing as you only pay for the associated
resources.
• AKS is integrated with the Azure Active Directory (AD) and offers a higher
security level with role-based access controls.
• It seamlessly integrates with Microsoft solutions and is easy to manage using
Azure CLI or the Azure portal.
Google Kubernetes Services
• Google Kubernetes Engine (GKE) is a Kubernetes-managed service
developed by Google in 2015 to manage Google compute engine
instances running Kubernetes.
• GKE was the first ever Kubernetes-managed service, followed by
AKS and EKS. GKE offers more features and automation than its
competitors.
• Google charges $0.15 per hour per cluster.
Summary
• In today’s complex software development environments comprising multiple
operating systems, programming languages, plugins, frameworks, container
management, and architectures, Docker creates a standardized workflow
environment for every member throughout the product life cycle.
• More importantly, Docker is open-source and supported by a strong and vibrant
community which is available to help you with any issues.
• Failing to successfully leverage Docker use cases will surely keep you behind
your competitors.

Lectre # 11 (VS&S). virtualization .pptx

  • 1.
    Vitual Systems andServices Lec # 11 Docker Government College University, Faisalabad BS IT 6th Semester 15/09/2024 Prepared by: Gul Farheen Ulfat
  • 2.
    Introduction • Docker isa containerization technology that enables developers to package a service into a container along with its dependencies, libraries and operating system. • By separating the apps from the infrastructure, Docker allows you to seamlessly deploy and move apps across a variety of environments. • Docker makes it very simple to create and manage containers using the following steps Create a Docker file and add the code Build a Docker image based on the Dockerfile Create a running instance from the Docker image Scale containers on-demand
  • 3.
    Containers • A containeris a notable use case of microservices architecture. • A container is a standard unit of software that isolates an application from its underlying infrastructure by packaging it with all dependencies and required resources. • Unlike virtual machines, which virtualize hardware layers, containers only virtualize software layers above the OS level.
  • 4.
    • Docker hasbecome synonymous with containerization because of its portability and ecosystem. • All major cloud providers such as AWS, GCP and Azure have incorporated Docker into the system and also provide support. • Therefore, you can seamlessly run Docker containers on any environment including VirtualBox, Rackspace andOpenStack. Scalability is one of the biggest benefits of Docker. • By deploying multiple containers on a single host, organizations can significantly reduce operational costs. Moreover, Docker allows you to deploy services on commodity hardware thus eliminating the costs of purchasing expensive servers.
  • 6.
    Benefits of Containers •Portability: Containers encapsulate all dependencies, making it easy to run the same containerized application across various environments (e.g., development, staging, production) without compatibility issues. • Isolation: Containers provide process and file system isolation, ensuring that applications do not interfere with each other. • Efficiency: Containers use fewer resources than virtual machines because they share the host operating system's kernel rather than running their own OS.
  • 8.
  • 9.
    • Docker makesuse of a client-server architecture. The Docker client talks with the docker daemon which helps in building, running, and distributing the docker containers. • The Docker client runs with the daemon on the same system or we can connect the Docker client with the Docker daemon remotely. • With the help of REST API over a UNIX socket or a network, the docker client and daemon interact with each other.
  • 11.
    Docker Daemon •Docker daemonmanages all the services by communicating with other daemons. •It manages docker objects such as images, containers, networks, and volumes with the help of the API requests of Docker.
  • 12.
    Docker Client • Withthe help of the docker client, the docker users can interact with the docker. The docker command uses the Docker API. • The Docker client can communicate with multiple daemons. When a docker client runs any docker command on the docker terminal then the terminal sends instructions to the daemon. The Docker daemon gets those instructions from the docker client withinside the shape of the command and REST API’s request. • The main objective of the docker client is to provide a way to direct the pull of images from the docker registry and run them on the docker host. • The common commands which are used by clients are docker build, docker pull, and docker run
  • 13.
    Docker Host •A Dockerhost is a type of machine that is responsible for running more than one container. •It comprises the Docker daemon, Images, Containers, Networks, and Storage.
  • 14.
    Docker Registery • Allthe docker images are stored in the docker registry. There is a public registry which is known as a docker hub that can be used by anyone. • We can run our private registry also. With the help of docker run or docker pull commands, we can pull the required images from our configured registry. • Images are pushed into configured registry with the help of the docker push command.
  • 15.
    Docker Objects Whenever weare using a docker, we are creating and use images, containers, volumes, networks, and other objects. Now, we are going to discuss docker objects:-
  • 16.
    Docker Images • Animage contains instructions for creating a docker container. It is just a read-only template. • It is used to store and ship applications. Images are an important part of the docker experience as they enable collaboration between developers in any way which is not possible earlier.
  • 17.
    Docker Containers • Containersare created from docker images as they are ready applications. With the help of Docker API or CLI, we can start, stop, delete, or move a container. • A container can access only those resources which are defined in the image unless additional access is defined during the building of an image in the container.
  • 18.
    Docker Storage • Wecan store data within the writable layer of the container but it requires a storage driver. Storage driver controls and manages the images and containers on our docker host.
  • 19.
    Types of DockerStorage • Data Volumes: Data Volumes can be mounted directly into the filesystem of the container and are essentially directories or files on the Docker Host filesystem. • Volume Container: In order to maintain the state of the containers (data) produced by the running container, Docker volumes file systems are mounted on Docker containers. independent container life cycle, the volumes are stored on the host. This makes it simple for users to exchange file systems among containers and backup data. • Directory Mounts: A host directory that is mounted as a volume in your container might be specified. • Storage Plugins: Docker volume plugins enable us to integrate the Docker containers with external volumes like Amazon EBS by this we can maintain the state of the container.
  • 20.
    Docker Networking • Dockernetworking provides complete isolation for docker containers. It means a user can link a docker container to many networks. It requires very less OS instances to run the workload. • Types of Docker Network • Bridge: It is the default network driver. We can use this when different containers communicate with the same docker host. • Host: When you don’t need any isolation between the container and host then it is used. • Overlay: For communication with each other, it will enable the swarm services. • None: It disables all networking. • macvlan: This network assigns MAC(Media Access control) address to the containers which look like a physical address
  • 21.
    • Docker’s underlyingmotto includes fewer resources and smaller engineering teams. • Organizations can therefore perform operations using fewer resources and thereby require less staff to monitor and manage such operations. This means cost savings and more ROI. • Docker allows you to instantly create and manage containers with ease, which facilitates faster deployments. • The ability to deploy and scale infrastructure using a simple YAML config file makes it easy to use all while offering a faster time to market. Security is prioritized with each isolated container.
  • 23.
  • 24.
    Kubernetes • Kubernetes isthe most popular container management tool developed by Google. It wasn’t long before Kubernetes became a de facto standard for container management and orchestration. • Google moved the tool to Cloud Native Computing Foundation (CNCF), which means the tool is now supported by industry giants such as IBM, Microsoft, Google andRedHat. • It enables you to quickly package, test, deploy and manage large clusters of containers with ease. It’s also open-source, cost-effective and cloud-agnostic.
  • 25.
    Amazon EKS • AsKubernetes became a standard for container management cloud providers started to incorporate it into their platform offerings. • Amazon Elastic Kubernetes Service (EKS) is a managed Kubernetes service for managing Kubernetes on AWS. With EKS organizations don’t need to install and configure Kubernetes work nodes or planes seeing as it handles that for you. • In a nutshell, EKS acts as a container service and manages container orchestration for you. However, EKS only works with AWS cloud.
  • 26.
    Amazon ECS • AmazonElastic Container Service (ECS) is a fully managed container management tool for AWS environments which helps organizations manage microservices and batch jobs with ease. • ECS looks similar to EKS but differs seeing as it manages container clusters, unlike EKS which only performs Kubernetes tasks. ECS is free while EKS charges $0.1 per hour. That said, seeing as it’s open-source, EKS provides you with more support from the community. • ECS, on the other hand, is more of a proprietary tool. ECS is mostly useful for people who don’t have extensive DevOps resources or who find Kubernetes to be complex.
  • 27.
    Azure Kubernetes Service •Azure Kubernetes Service (AKS) a container management tool that is a fully- managed Kubernetes service offered by Microsoft for Azure environments. • It’s open-source and mostly free seeing as you only pay for the associated resources. • AKS is integrated with the Azure Active Directory (AD) and offers a higher security level with role-based access controls. • It seamlessly integrates with Microsoft solutions and is easy to manage using Azure CLI or the Azure portal.
  • 28.
    Google Kubernetes Services •Google Kubernetes Engine (GKE) is a Kubernetes-managed service developed by Google in 2015 to manage Google compute engine instances running Kubernetes. • GKE was the first ever Kubernetes-managed service, followed by AKS and EKS. GKE offers more features and automation than its competitors. • Google charges $0.15 per hour per cluster.
  • 29.
    Summary • In today’scomplex software development environments comprising multiple operating systems, programming languages, plugins, frameworks, container management, and architectures, Docker creates a standardized workflow environment for every member throughout the product life cycle. • More importantly, Docker is open-source and supported by a strong and vibrant community which is available to help you with any issues. • Failing to successfully leverage Docker use cases will surely keep you behind your competitors.