You are on page 1of 25

Introduction to containers and Docker

Containers Immersion Day: Module 1

Bala Ravilla Koushik Mohan


Global Partner Solutions Architect Partner Solutions Architect, APAC

© 2020, Amazon Web Services, Inc. or its Affiliates.


First things first…

What are containers and why are


customers using them?

© 2020, Amazon Web Services, Inc. or its Affiliates.


Why are companies
adopting containers?

© 2020,
© 2020,
Amazon
Amazon
WebWeb
Services,
Services,
Inc. Inc.
or its
orAffiliates.
its Affiliates. All rights reserved. Amazon Confidential
Why are companies
adopting containers?
• Accelerate software development

© 2020,
© 2020,
Amazon
Amazon
WebWeb
Services,
Services,
Inc. Inc.
or its
orAffiliates.
its Affiliates. All rights reserved. Amazon Confidential
Why are companies
adopting containers?
• Accelerate software development
• Build modern applications

© 2020,
© 2020,
Amazon
Amazon
WebWeb
Services,
Services,
Inc. Inc.
or its
orAffiliates.
its Affiliates. All rights reserved. Amazon Confidential
Why are companies
adopting containers?
• Accelerate software development
• Build modern applications
• Automate operations at web scale

© 2020,
© 2020,
Amazon
Amazon
WebWeb
Services,
Services,
Inc. Inc.
or its
orAffiliates.
its Affiliates. All rights reserved. Amazon Confidential
© 2020,
© 2020,
Amazon
Amazon
WebWeb
Services,
Services,
Inc. Inc.
or its
orAffiliates.
its Affiliates. All rights reserved. Amazon Confidential
Application environment components

Runtime Code
Engine

Dependencies Configuration

© 2020, Amazon Web Services, Inc. or its Affiliates.


Different environments

Local Laptop Staging / QA Production On-Prem

© 2020, Amazon Web Services, Inc. or its Affiliates.


It worked on my machine, why not in prod?

v7.0.0 v4.0.0 v7.0.0


v6.0.0

Local Laptop Staging / QA Production On-Prem

© 2020, Amazon Web Services, Inc. or its Affiliates.


Containers to the rescue

Runtime Engine

Dependencies

Code

© 2020, Amazon Web Services, Inc. or its Affiliates.


2020, Amazon Web Services, Inc. or its Affiliates.
© 2019,
What is Docker?
A container is a standard unit of software that packages up code and all its dependencies so the
application runs quickly and reliably from one computing environment to another

Lightweight container virtualization platform.

Ecosystem of tools to manage and deploy your


applications

Licensed under the Apache 2.0 license.

Built by Docker, Inc.

Moby: Open source project


Docker architecture
Docker daemon manages images, containers, Docker client
networks, and volumes

Docker CLI communicates with Docker daemon


through a REST API Docker daemon /
REST API

Docker
host
Sample commands: Docker registry
Container 1

Container 2
docker build – Build image from Dockerfile Container n
docker images – List images on Docker host Ubuntu image
docker run – Run an image Nginx image
Docker
docker ps – List running containers hub Custom image

docker stop – Stop a running container

© 2020,
© 2019, Amazon
Amazon Web Services,
Web Services, Inc.
Inc. or its or its Affiliates.
Affiliates. All rights reserved.
Containers vs VMs
Containers Virtual Machines
- Using Linux primitives for - Virtualisation or emulate
isolation hardware components
- Share Linux Kernel - Completely separate kernels
- Fast starts, minimal overhead (maybe not Linux)
- Flexible isolation - Slower starts, must boot kernel
and set-up hardware.
Container Container VM Guest VM Guest

cgroups namespaces --- Virt Hardware Virt Hardware

Linux Kernel Linux Kernel KVM

Hardware Hardware

© 2020, Amazon Web Services, Inc. or its Affiliates.


What are containers made from?
Linux container primitives …

• … unshare
• … /sys/fs/cgroup/memory
• … capsh
• … Secomp
• … Linux security modules
• … Union file systems

© 2020, Amazon Web Services, Inc. or its Affiliates.


Container images

W
Read only image that is used as a

rit
ab
template to launch a container.

ad

le
Container

d
N
GI
N
ad
Start from base images that have

X
Image

d
References

n
your dependencies, add your

od
parent

ej
image

U
custom code. Image

s
bu
nt
u
Base image
Dockerfile for easy,
reproducible builds. bootfs

kernel

© 2020, Amazon Web Services, Inc. or its Affiliates.


Four environments, same container

Local Laptop Staging / QA Production On-Prem

© 2020, Amazon Web Services, Inc. or its Affiliates.


Container benefits

Runs reliably everywhere Run different apps simultaneously Better resource utilization

© 2020, Amazon Web Services, Inc. or its Affiliates.


CICD Pipeline with Blue-Green Deployment
AWS Cloud

AWS Region
VPC

Monitoring:
CloudWatch & X-Ray
CodeCommit
Repository

DEV

MAIN

Code Push
S3 Bucket

Cloud9
IDE CodePipeline:
.......... CICD Pipeline
CodeBuild Deploy to Manual Swap ALB
Green Env Approval Target-Groups

Developers
© 2020, Amazon Web Services, Inc. or its Affiliates.
Demo of launching a container

© 2019,
2020, Amazon Web Services, Inc. or its Affiliates.
Managing one containers is pretty easy

© 2020, Amazon Web Services, Inc. or its Affiliates.


Managing many containers is hard

© 2020, Amazon Web Services, Inc. or its Affiliates.


AWS container services landscape

Amazon Elastic
Management Amazon Elastic
Container Service
Deployment, Scheduling, Container Service
for Kubernetes
Scaling & Management of
containerized applications

Hosting Amazon EC2 AWS Fargate


Where the containers run

Image Registry Amazon Elastic


Container Image Repository Container Registry

© 2020, Amazon Web Services, Inc. or its Affiliates.


Questions?
Introduction to containers and Docker

© 2020, Amazon Web Services, Inc. or its Affiliates.

You might also like