CONTAINERS
1
Topic List
#No Module Topics
1 Introduction to containers
2 What do containers solve
3 How containers different from VMs
4 Docker introduction
5 Docker components
6 Kubernetes Overview
2
INTRODUCTION TO
CONTAINERS
3
What is Virtualization?
A combination of Virtualization and networking are what make cloud possible.
▪ Started in 1967 with the IBM CP-40
▪ Virtual machine (VM) software is a program that emulates a physical
machine
▪ A VM needs to act exactly like its physical machine
▪ One physical machine is capable of emulating multiple virtual
machines
What are containers?
Containers are an evolution of virtualization, externalizing the operating system itself.
▪ Containers share the same host OS
▪ Provide separation between individual application environments
▪ Container images are smaller than hosting virtual machines
▪ They start faster while using lesser machine memory
▪ They can be carried across machines and replicated with ease.
▪ It improves the utilization of machine resources like CPU, RAM, etc.
What Problem are we Solving?
Application
Application
Application
Application
Application
Business
Business
Business
Business
Business
Business
Applicatio
nsmodel
Security
Deployment architecture
Logical environment separation
Platform and basic infra Execution architecture
Platform Infrastructure orchestration
automation > Basic Infrastructure orchestration
Hardware management
Virtual Private Cloud
Subnets
Virtual Machines
Diagram for illustration only
What Problem are we Solving?
…to this!
Virtual Private Cloud
Subnets
Virtual Machines
Execution architecture
ready for use
Diagram for illustration only
How this time then?
…with Docker containers
Virtual Private Cloud
Subnets
Virtual Machines
Execution architecture
ready for use
Diagram for illustration only
And maybe some like this
…multiple Docker containers per VM
Virtual Private Cloud
Subnets
Virtual Machines
Execution architecture
ready for use
Diagram for illustration only
Copyright © 2018 Accenture. All rights reserved.
A CONTAINER IS…
“A SELF-SUFFICIENT
APPLICATION
PACKAGE”
10
How Container differs from Virtual Machines
The below shows the fundamental difference in Virtual Machines and Container:
Virtual Machines Container (Docker)
App A App B
Each virtualized application App A App B The Docker Engine container
includes not only the Bins/Libs Bins/LIbs
comprises just the application
Bins/Libs Bins/LIbs
application - which may be and its dependencies. It runs
Docker Engine
Guest OS Guest OS
only 10s of MB - and the as an isolated process in
Hypervisor necessary binaries and Host OS userspace on the host
Host OS libraries, but also an entire Server operating system, sharing the
Server
guest operating system - kernel with other containers.
which may weigh 10s of GB. Thus, it enjoys the resource
isolation and allocation
benefits of VMs but is much
more portable and efficient.
Some diagrams taken from: [Link]
What are microservices?
A decentralized architectural style that structures an application as a collection of independent/semi-
dependent services, called as consumable APIs.
▪ Reusable services across channels
▪ Highly understandable, maintainable and testable
▪ Independently deployable and minimizes the risk of change.
▪ Organized around business capabilities and allows
evolution of functionalities
▪ Each service is owned by a small team
12 factor principle the first six
The twelve-factor principle is a methodology for building software-as-a-service apps improving time, cost &
scalability while offering maximum portability between environments with minimal administration.
• One code base, versioned & revision
Linkable Backend • Treat backing services as attached
Code Base 1 controlled with ability to deploy to multiple Services
4 resources, independent of the consumers
environments through config
Dependency • Explicitly declare and isolate
2 dependencies, keeping applications Stages of • Strictly separate build and run stages
Isolation 5 before test & deployment
separate Creation
• Store config in the environment, easier to Stateless • Omnichannel workflows, seamlessly
Configurations 3 update and isolated from the code base 6 transfer consumers between devices
Processes
12 factor principle the second six
• Utilize different ports for different Dev & Prod • Keep development, staging, and
Port Binding 7 applications, isolating their functionalities 10 production as similar as possible
Parity
• Allows horizontal scaling of applications
• All application logs are centrally collated
Concurrency 8 through duplication of services hosted Logs 11 as events
simultaneously
• Maximize robustness with fast startup Admin
Disposability 9 and graceful shutdown while minimizing 12• Scheduled tasks and processes
downtime Processes
Docker
Docker engine for containers
What is Docker?
An open source OS–level By default uses LXC (Linux A tool that makes
virtualization manager Containers) to create trivially easy to use
isolated virtual environments containers capabilities
Portable and immutable
deployment It is application-centric, Consists of Docker Engine,
across machines allows rapid building, a lightweight runtime and a
shipping, and running packaging tool
Docker includes git-like of distributed applications
capabilities for tracking using containers Docker has access to
successive versions of a registry hubs
images and containers Any container can be used (private and public),
as an "base image" this make sharing easy
Developers can build
any app in any language System administrators use Docker to provide
using any tool chain standardised environments for their development,
quality assurance, and production teams
Docker components
We defined
DOCKER IMAGES DOCKER CONTAINERS DOCKER REGISTRIES
• Read-only template • Are spun from images • Docker registries hold
• Images are frozen files • A Docker container holds images
that act as blueprint for everything that is needed • Community Docker Hub:
containers for an application to run [Link]
• Multiple containers can be • Docker Accenture Hub:
run from a single image [Link]
HOW TO USE DOCKER
DOCKER ENGINE FOR CONTAINERS
Docker
Container
Push
Container Image
A Registry
Search Pull
Dockerfile
for A Build
Run
Source Code
Repository Container Container Container
A B C
Docker Engine
Docker Engine
Host 1 OS
(Linux) Host 2 OS 2 (Linux)
Value Proposition - What are containers for?
Developers
• Increased productivity as can focus on building applications.
• Can use any technology stack or application framework
• Create and run any containers in self-defined environments (dev, prod, CI/CD, test, acceptance, performance)
IT Management
• Run on any infrastructure, on premise, private, hybrid or public cloud
• Increase resource usage and control infrastructure spend
• Centrally manage users, resource constraints and allocations
• Enable standardized practices and patterns, e.g., secrets management, load balancing, deployments
Business
• Faster time to market for new services and products
• Lower IT costs
• Reduce deployment failure
Container Security Tools
Security Analysis Tools
Docker scan CoreOS Clair Docker Bench Lynis
for Security
Description It is a Docker toolkit It is the open-source static It is the script Security auditing
for security analysis analysis / vulnerabilities which checks the tool for systems
which includes management tool for application common best running Linux, mac
attacking tools. It is containers. practices for OS, or Unix, to
more focused on
Docker in the perform an in-
side of the offensive
production depth health
than defensive.
environment check.
Usage and It is used for used It is used for security It is used It can detect
Audience for information assessment or vulnerability for application security
gathering, security security or security vulnerabilities and
assessment, scanning. Target users for this
assessment. configuration flaws.
or vulnerability tool are security
Target audience Target audience
scanning. Target professionals and system
are developers, se are
users for this tool administrators.
are pentesters and curity auditors, security
security professionals, professionals,
and system and system
professionals . administrators administrators.
Programming Python Golang Shell script Shell script
Languages
Page
Copyright © 2016 Accenture All rights 20
Container PaaS’
No longer have to think about where your containers are
Let a software application your PaaS (sometimes called micro PaaS) work out where to put your containers
Let it create extra VMs or
kill them as needed
Openshift Kubernetes
ΚυβερνήΤηϚ: Greek for “pilot” or “helmsman of ship”
The open source cluster manage from Google
This area is exploding with new stuff!
[Link]
KUBERNETES-OVERVIEW
22
What is Kubernetes(K8S)?
➢ Kubernetes is open-source container orchestration tool designed to automate
deploying, scaling and operating containerized applications.
➢ Containers are a good way to bundle and run your applications. In a
production environment, you need to manage the containers that run the
applications and ensure that there is no downtime. For example, if a container
goes down, another container needs to start. That’s how Kubernetes comes to
the rescue!
➢ Kubernetes provides a framework to run distributed systems resiliently. It
takes care of your scaling requirements, failover, deployment patterns, and
more.
➢ In nutshell Kubernetes is a container orchestration tool while Docker is a
platform and tool for building, distributing, and running containers.
Kubernetes features
Fault
Highly Tolerant and
available Self healing
without any Infrastructur
downtime e
Simplified
process of
deployment
Horizontal Resilient to
scaling fluctuation in
when Efficient use load
required of Cloud
resources
Kubernetes More Insights
Objects like Pods, Deployments, Services are defined in YAML file
Pod Deployment
When to use Dockers and Kubernetes
Scenario Can be achieved with Fitment
Microservices need to be polyglot. Docker
Microservices can be based on Node JS & Spring boot framework.
Any new framework required needs to be accommodated in future.
Microservices need to scale independently and automatically. Kubernetes
Management of resources in the cluster and ensuring that containers remain
within their allocated resource quotas.
Microservices need to be resilient. Kubernetes
Scheduling containers on available nodes, and rescheduling them in case of
node or container failure
Scheduling containers on available nodes, and rescheduling them in case of Kubernetes
node or container failure
Microservices need to have near zero downtime for deployments. Docker
Microservices need to be developed and deployed independently. Docker
Microservices need to run independently and should be platform Docker
independent
Run time images of containers need to stored and versioned Docker
Microservices need to communicate with each other Kubernetes
Orchestrating the deployment of applications built out of multiple containers,
and ensuring that components can communicate across the cluster
Secure configuration and password management Kubernetes Kubernetes
Landscape Of Container and Orchestration
Workflow
Orchestration
Clustering & Scheduling
Container Engine
LXD
Operating System (Host and
Container)
Ubuntu Snappy
Virtual Infrastructure
Physical Infrastructure
Computing Storage
LAB ACTIVITY
30 minutes
28
Thank You
29