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

Container& Docker1

Uploaded by

Yuvika
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Container& Docker1

Uploaded by

Yuvika
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Container & Docker

Container - diagram
Defining containers
• Containers are lightweight packages of your application
code together with dependencies such as specific
versions of programming language runtimes and
libraries required to run your software services.
Containers- benefits
• Like virtual machines, containers allow you to package your
application together with libraries and other dependencies,
providing isolated environments for running your software
services. As you’ll see below, however, the similarities end here
as containers offer a far more lightweight unit for developers
and IT Ops teams to work with, carrying a myriad of benefits.
• Containers are much more lightweight than VMs
• Containers virtualize at the OS level while VMs virtualize at the
hardware level
• Containers share the OS kernel and use a fraction of the
memory VMs require
Benefits –continued
• Less overhead
Containers require less system resources than traditional or hardware virtual machine
environments because they don’t include operating system images.

• Increased portability
Applications running in containers can be deployed easily to multiple different operating
systems and hardware platforms.

• More consistent operation


DevOps teams know applications in containers will run the same, regardless of where they are
deployed.

• Greater efficiency
Containers allow applications to be more rapidly deployed, patched, or scaled.

• Better application development


Containers support agile and DevOps efforts to accelerate development, test, and production
cycles.
Use of containers
• 1--Agile development
• Containers allow your developers to move much more quickly by
avoiding concerns about dependencies and environments.
• 2--Efficient operations
• Containers are lightweight and allow you to use just the
computing resources you need. This lets you run your
applications efficiently.
• Run anywhere
• Containers are able to run virtually anywhere. Wherever
you want to run your software, you can use containers.
Disadvantages of containers
• 1. Security: Containers share the same host kernel, which can pose a
security risk. If a container is compromised, it can potentially affect other
containers on the same host.
• 2. Complexity: Containers can be complex to set up and manage, especially
in large-scale environments. Container orchestration tools, such as
Kubernetes, can help to simplify the process, but they can also add
complexity.
• 3. Storage: Containers are designed to be stateless, meaning they don’t
store data or state. This can make managing persistent data, such as
databases, a complex within a container environment.
• 4. Networking: Containers can be challenging to network, especially across
multiple hosts or environments. Container networking can be complex, and
it requires careful planning and management to ensure that containers can
communicate with each other and with external services.
What is a dockerfile?
• Docker builds images automatically by reading the
instructions from a Dockerfile which is a text file that
contains all commands, in order, needed to build a
given image. A Dockerfile adheres to a specific format
and set of instructions which you can find at Dockerfile
reference.
• A Docker image consists of read-only layers each of
which represents a Dockerfile instruction. The layers are
stacked and each one is a delta of the changes from the
previous laye
Contents of file

In the example above, each instruction creates one layer:

•FROM creates a layer from the ubuntu:22.04 Docker image.


•COPY adds files from your Docker client's current directory.
•RUN builds your application with make.
•CMD specifies what command to run within the container.
What is a docker ?
• Docker works by providing a standard way to run your
code. Docker is an operating system for containers.
Similar to how a virtual machine virtualizes (removes
the need to directly manage) server hardware,
containers virtualize the operating system of a server.
Docker is installed on each server and provides simple
commands you can use to build, start, or stop
containers.
• Components of Docker Software
1.Software
2.Objects
3.Registry
Benefits of docker
1.Tailor-made: Most industries want to use a purpose-built. The Docker in cloud
computing enables its clients to make use of Docker to organize their software
infrastructure.
2.Accessibility: As the docker is a cloud framework, it is accessible from anywhere,
anytime. Has high efficiency.
3.Operating System Support: It takes less space. They are lightweight and can
operate several containers simultaneously.
4.Performance: Containers have better performance as they are hosted in a single
docker engine.
5.Speed: No requirement for OS to boot. Applications are made online in seconds. As the
business environment is constantly changing, technological up-gradation needs to keep
pace for smoother workplace transitions. Docker helps organizations with the speedy
delivery of service.
6.Flexibility: They are a very agile container platform. It is deployed easily across
clouds, providing users with an integrated view of all their applications across different
environments. Easily portable across different platforms.
Docker--diagram
More on docker
• Docker provides tooling and a platform to manage the lifecycle
of your containers:
• Develop your application and its supporting components using
containers.
• The container becomes the unit for distributing and testing your
application.
• When you're ready, deploy your application into your production
environment, as a container or an orchestrated service. This
works the same whether your production environment is a local
data center, a cloud provider, or a hybrid of the two.
• What can I use Docker for?
Docker architecture
More on docker
• Docker uses a client-server architecture. The Docker
client talks to the Docker daemon, which does the
heavy lifting of building, running, and distributing your
Docker containers. The Docker client and daemon can
run on the same system, or you can connect a Docker
client to a remote Docker daemon.
• The Docker client and daemon communicate using a
REST API, over UNIX sockets or a network interface.
Another Docker client is Docker Compose, that lets you
work with applications consisting of a set of containers.
Terminology in docker
• 1. Docker Image
• It is a file, comprised of multiple layers, used to execute code in a Docker container.
• They are a set of instructions used to create docker containers.
• 2. Docker Container
• It is a runtime instance of an image.
• Allows developers to package applications with all parts needed such as libraries and other dependencies.
• 3. Docker file
• It is a text document that contains necessary commands which on execution helps assemble a Docker Image.
• Docker image is created using a Docker file.
• 4. Docker Engine
• The software that hosts the containers is named Docker Engine.
• Docker Engine is a client-server based application
• The docker engine has 3 main components:
• Server: It is responsible for creating and managing Docker images, containers, networks, and volumes on the Docker. It
is referred to as a daemon process.
• REST API: It specifies how the applications can interact with the Server and instructs it what to do.
• Client: The Client is a docker command-line interface (CLI), that allows us to interact with Docker using the docker
commands
Difference between Docker Containers and
Virtual Machines

• 1. Docker Containers
• Docker Containers contain binaries, libraries, and configuration files along with
the application itself.
• They don’t contain a guest OS for each container and rely on the underlying OS
kernel, which makes the containers lightweight.
• Containers share resources with other containers in the same host OS and
provide OS-level process isolation.
• 2. Virtual Machines
• Virtual Machines (VMs) run on Hypervisors, which allow multiple Virtual Machines
to run on a single machine along with its own operating system.
• Each VM has its own copy of an operating system along with the application and
necessary binaries, which makes it significantly larger and it requires more
resources.
• They provide Hardware-level process isolation and are slow to boot.
Docker file

A Dockerfile is a text document that contains commands that are used to assemble an image. We can
use any command that call on the command line. Docker builds images automatically by reading the
instructions from the Dockerfile.

The docker build command is used to build an image from the Dockerfile. You can use the -f flag with
docker build to point to a Dockerfile anywhere in your file system.

$ docker build -f /path/to/a/Dockerfile .


Dockerfile Instructions
The instructions are not case-sensitive but you must follow conventions which recommend to use
uppercase.

Docker runs instructions of Dockerfile in top to bottom order. The first instruction must be FROM in
order to specify the Base Image.
What is a kubernetes
• Kubernetes is a portable, extensible, open source
platform for managing containerized workloads and
services, that facilitates both declarative configuration
and automation. It has a large, rapidly growing
ecosystem. Kubernetes services, support, and tools are
widely available.
• The name Kubernetes originates from Greek, meaning
helmsman or pilot. K8s as an abbreviation results from
counting the eight letters between the "K" and the "s".
Kubernetes architecture
Describing kubernetes
• Kubernetes provides a flexible architecture for
discovering services within a cluster while maintaining
loose connections. A Kubernetes cluster comprises a set
of control planes and compute nodes. The primary role
of the control plane is to oversee the entire cluster,
expose the API, and manage the scheduling of compute
nodes according to the desired settings. The compute
nodes run container runtimes such as Docker, alongside
a communication agent called kubelet, which interacts
with the control plane. These nodes can consist of
physical servers, virtual machines (VMs) in on-premises
or cloud environments.
What kuberenetes can do?
Advantages
Use cases
Benefits of kubernetes

You might also like