SlideShare a Scribd company logo
1 of 19
Download to read offline
INTRODUCTION TO
CONTAINERIZATION
BALINT PATO
SOFTWARE CRAFTSMANSHIP NYC MEETUP
11/17/2016
CURRICULUM FOR TODAY
▸ slides: curriculum
▸ hands-on: install docker, hello-world
▸ slides: containerization foundations
▸ hands-on: build an image from an app, run it, peak into the container
▸ slides: isolation and resource management
▸ hands-on: talking to the daemon, pushing the image to DockerHub,
isolation experiments!
▸ discussion
INTRODUCTION TO CONTAINERIZATION
INTRODUCTION TO CONTAINERIZATION
LET’S START HANDS-ON
TEST
> docker run hello-world
INTRODUCTION TO CONTAINERIZATION
WHAT IS CONTAINERIZATION?
▸ metaphor I.

shipping container
▸ standard packaging
▸ isolation method
▸ composability
INTRODUCTION TO CONTAINERIZATION
WHAT IS CONTAINERIZATION?
▸ metaphor II.

lightweight, fast virtualization
▸ a container is like a virtual machine
but magnitudes faster to spin it up
▸ own networking stack
▸ own filesystem
▸ own process IDs
▸ …but it runs on a host machine!
INTRODUCTION TO CONTAINERIZATION
BENEFITS: WHAT ARE CONTAINERS GOOD FOR?
▸ repeatability: I build the image once, and
deploy (roughly) the same thing prod
▸ portability: as long as the runtime is
available for a platform, the container can
run there too.
▸ reusable filesystem setup: layers are the
base of reuse
▸ standard execution and distribution: most
(I consider windows preview only) software
stacks are supported
▸ density: I can deploy multiple instances next
to each other and split up the resources
INTRODUCTION TO CONTAINERIZATION
BENEFITS: 

CLOUD NATIVE ARCHITECTURE
an important piece 

in the cloud puzzle
INTRODUCTION TO CONTAINERIZATION
DEFINITIONS
▸ containerization platform: a family of technologies to isolate processes from each other,
so that processes run as if they are running in a normal operating system while - enforced
by the container runtime - they actually share the resources of a single host without having
the ability to see each other's or the host's processes and resources. A platform also has
opinion about the runtime and the lifecycle of the image, from building to distribution. 

Examples: LXC, Rkt, Docker
▸ container runtime: container execution environment, which enforces the limited shares
of resources (e.g. cpu, memory, disk) allocated to the containerized application, also
exposes API and tools around managing containers. 

Examples: LXD, Docker daemon, Rkt process
▸ image: an image defines the filesystem and execution parameters for the container.
Images can be layered, composable, depending on the format. 

Examples: Docker image, appc, LXC image format
EXERCISE: LET’S BUILD AN IMAGE!
INTRODUCTION TO CONTAINERIZATION
FROM alpine
RUN apk add --no-cache bash curl py-pip
RUN pip install --upgrade pip
RUN pip install flask
COPY ./app.py /
ENTRYPOINT python /app.py
2. create docker-start/Dockerfile with the following content
> git clone https://github.com/balopat/docker-starter
1. get some sample code, discuss the flask app
> docker build -t nanoservice .
3. build the image and discuss: What can these instructions mean?
EXERCISE: LET’S RUN IT!
INTRODUCTION TO CONTAINERIZATION
> docker images
1. list images on your machine, discuss: what can you see?
> docker run -d -p 1234:5000 nanoservice
2. spin up a container, discuss: what’s the output?
> docker ps
3. list running containers, discuss the output
> docker logs <container-id>
4. get the logs, discuss the output - try accessing the app
EXERCISE: WHAT’S IN THE BOX?
INTRODUCTION TO CONTAINERIZATION
> docker exec <container-id> ls /
1. run this and discuss
> docker exec -ti <container-id> bash
2. run this and experiment around
container> ps ax
3. how many processes are in the container? what are their PIDs?
container> curl localhost:5000
4. try accessing the app from inside
INTRODUCTION TO CONTAINERIZATION
KEEP IN MIND:
THE DOCKER ARCHITECTURE: CLIENT-SERVER
INTRODUCTION TO CONTAINERIZATION
ISOLATION AND RESOURCE SHARING
▸ linux namespaces 

http://man7.org/linux/man-pages/man7/namespaces.7.html
▸ hostname
▸ net
▸ pid
▸ users
▸ mounts
▸ …
▸ linux cgroups 

https://en.wikipedia.org/wiki/Cgroups
▸ CPU share
▸ CPU set
▸ memory
▸ block I/O
▸ network priority
▸ …
INTRODUCTION TO CONTAINERIZATION
EXERCISE: PUNCH A WHOLE ON THE CONTAINER
> docker run -d -p 1234:5000 nanoservice
1. spin up a container with port mapping and discuss: what’s the output? 

what does docker ps show?
2. On Mac + Ubuntu desktops just access http://localhost:5000,
[on Windows with Docker Toolbox:
a.) find the boot2docker VM’s IP: run ‘docker-machine ls’ this will give you
a tcp://<boot2dockerVMIP>:XXXX in the response
b.) you can access the app at http://<boot2dockerVMIP>:1234
INTRODUCTION TO CONTAINERIZATION
https://hub.docker.com
1. Register on docker hub
> docker login
2. login
> docker tag nanoservice <username>/nanoservice
3. re-tag our service to setup the repository (check with docker images)
> docker push <username>/nanoservice
4. push!
EXERCISE: PUSH IT TO DOCKERHUB
EXERCISE: TALKING TO THE DAEMON
INTRODUCTION TO CONTAINERIZATION
> docker run -it --privileged -v /var/run/docker.sock:/var/
run/docker.sock appropriate/curl sh
> curl google.com
1. we’ll need curl
> ls /var/run/docker.sock
2. find /var/run/docker.sock
> curl --unix-socket /var/run/docker.sock http://localhost/images/json
3. let’s query the daemon!
EXERCISE: LIMIT MEMORY
INTRODUCTION TO CONTAINERIZATION
> docker run -ti -m 300M debian bash
1.Let’s get a shell limited to 300M of memory
> docker stats
2. another window, let’s see the amount of RAM you have!
https://docs.docker.com/engine/reference/run/
Loads of options to manage resource usage of apps:
> cat <(yes | tr n x | head -c $((1024*1024*300))) <(sleep 10) | grep n
3. let’s load stuff in the memory, follow the action in the docker stats!
EXERCISE: MAX OUT YOUR CPU - ONLY DO THIS IF YOU HAVE MORE THAN 1 CORE!
INTRODUCTION TO CONTAINERIZATION
> docker run -ti --cpuset-cpus="1" --cpu-quota=10000 debian bash
1.Let’s get a shell limited to 1 cpu and only 10% of it
> :(){ :|:& };:
2. Let’s drop the fork bomb
> docker stats
3. on another tab - let’s see the stats
> docker kill <container-id>
4. kill the cpu killer
CURRICULUM FOR TODAY
▸ slides: curriculum
▸ hands-on: install docker, hello-world
▸ slides: containerization foundations
▸ hands-on: build an image from an app, run it, peak into the container
▸ slides: isolation and resource management
▸ hands-on: talking to the daemon, pushing the image to DockerHub,
isolation experiments!
▸ well done! we can get to the discussion :)
INTRODUCTION TO CONTAINERIZATION

More Related Content

What's hot

Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Ryan Jarvinen
 
A brief study on Kubernetes and its components
A brief study on Kubernetes and its componentsA brief study on Kubernetes and its components
A brief study on Kubernetes and its componentsRamit Surana
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Edureka!
 
Docker intro
Docker introDocker intro
Docker introOleg Z
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with DockerRavindu Fernando
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopBob Killen
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Herofazalraja
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introductionSparkbit
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to KubernetesImesh Gunaratne
 
Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker, Inc.
 
Containers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red HatContainers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red HatAmazon Web Services
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes ArchitectureKnoldus Inc.
 
Evolution of containers to kubernetes
Evolution of containers to kubernetesEvolution of containers to kubernetes
Evolution of containers to kubernetesKrishna-Kumar
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker IntroductionPeng Xiao
 
Dockers and containers basics
Dockers and containers basicsDockers and containers basics
Dockers and containers basicsSourabh Saxena
 

What's hot (20)

Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17
 
A brief study on Kubernetes and its components
A brief study on Kubernetes and its componentsA brief study on Kubernetes and its components
A brief study on Kubernetes and its components
 
Containers 101
Containers 101Containers 101
Containers 101
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
 
Docker intro
Docker introDocker intro
Docker intro
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introduction
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016
 
Containers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red HatContainers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red Hat
 
What is Docker
What is DockerWhat is Docker
What is Docker
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes Architecture
 
Evolution of containers to kubernetes
Evolution of containers to kubernetesEvolution of containers to kubernetes
Evolution of containers to kubernetes
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Dockers and containers basics
Dockers and containers basicsDockers and containers basics
Dockers and containers basics
 

Viewers also liked

Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...Jérôme Petazzoni
 
Software Containerization
Software ContainerizationSoftware Containerization
Software ContainerizationRoshan Deniyage
 
Containerization (Export/Import Goods)
Containerization (Export/Import Goods)Containerization (Export/Import Goods)
Containerization (Export/Import Goods)Dr. Sneha Sharma
 
A Primer to Containerization & Microservices
A Primer to Containerization & MicroservicesA Primer to Containerization & Microservices
A Primer to Containerization & MicroservicesShiju Varghese
 
Hide your development environment and application in a container
Hide your development environment and application in a containerHide your development environment and application in a container
Hide your development environment and application in a containerJohan Janssen
 
Containerization using docker
Containerization using dockerContainerization using docker
Containerization using dockerVinod Doshi
 
Essence Of Containerizati on 230508
Essence Of Containerizati on 230508 Essence Of Containerizati on 230508
Essence Of Containerizati on 230508 jansowri
 
Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Dmitry Guyvoronsky
 
Docker containerization cookbook
Docker containerization cookbookDocker containerization cookbook
Docker containerization cookbookPascal Louis
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and dockerDuckDuckGo
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized DevelopmentAdam Culp
 
Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Dockerjchase50
 
Let’s start Continuous Integration with jenkins
Let’s start Continuous Integration with jenkinsLet’s start Continuous Integration with jenkins
Let’s start Continuous Integration with jenkinsTomohide Kakeya
 
Enterprise Development Trends 2016 - Cloud, Container and Microservices Insig...
Enterprise Development Trends 2016 - Cloud, Container and Microservices Insig...Enterprise Development Trends 2016 - Cloud, Container and Microservices Insig...
Enterprise Development Trends 2016 - Cloud, Container and Microservices Insig...Lightbend
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩Wen-Tien Chang
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Carlos Sanchez
 

Viewers also liked (20)

Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...
 
Containerization
ContainerizationContainerization
Containerization
 
Software Containerization
Software ContainerizationSoftware Containerization
Software Containerization
 
Containerization (Export/Import Goods)
Containerization (Export/Import Goods)Containerization (Export/Import Goods)
Containerization (Export/Import Goods)
 
A Primer to Containerization & Microservices
A Primer to Containerization & MicroservicesA Primer to Containerization & Microservices
A Primer to Containerization & Microservices
 
Hide your development environment and application in a container
Hide your development environment and application in a containerHide your development environment and application in a container
Hide your development environment and application in a container
 
Containerization using docker
Containerization using dockerContainerization using docker
Containerization using docker
 
Essence Of Containerizati on 230508
Essence Of Containerizati on 230508 Essence Of Containerizati on 230508
Essence Of Containerizati on 230508
 
Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)
 
Docker containerization cookbook
Docker containerization cookbookDocker containerization cookbook
Docker containerization cookbook
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 
Virtual Container - Docker
Virtual Container - Docker Virtual Container - Docker
Virtual Container - Docker
 
Vagrant + Docker
Vagrant + DockerVagrant + Docker
Vagrant + Docker
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
 
Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Docker
 
Let’s start Continuous Integration with jenkins
Let’s start Continuous Integration with jenkinsLet’s start Continuous Integration with jenkins
Let’s start Continuous Integration with jenkins
 
Enterprise Development Trends 2016 - Cloud, Container and Microservices Insig...
Enterprise Development Trends 2016 - Cloud, Container and Microservices Insig...Enterprise Development Trends 2016 - Cloud, Container and Microservices Insig...
Enterprise Development Trends 2016 - Cloud, Container and Microservices Insig...
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 

Similar to Intro to containerization

時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇Philip Zheng
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇Philip Zheng
 
Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioJérôme Petazzoni
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...Codemotion
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 
Novices guide to docker
Novices guide to dockerNovices guide to docker
Novices guide to dockerAlec Clews
 
Orchestrating Docker with OpenStack
Orchestrating Docker with OpenStackOrchestrating Docker with OpenStack
Orchestrating Docker with OpenStackErica Windisch
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020CloudHero
 
Docker and the Container Revolution
Docker and the Container RevolutionDocker and the Container Revolution
Docker and the Container RevolutionRomain Dorgueil
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Developmentmsyukor
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Ricardo Amaro
 

Similar to Intro to containerization (20)

時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 
Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific Trio
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Novices guide to docker
Novices guide to dockerNovices guide to docker
Novices guide to docker
 
Docker training
Docker trainingDocker training
Docker training
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Orchestrating Docker with OpenStack
Orchestrating Docker with OpenStackOrchestrating Docker with OpenStack
Orchestrating Docker with OpenStack
 
Docker研習營
Docker研習營Docker研習營
Docker研習營
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Docker
DockerDocker
Docker
 
Docker and the Container Revolution
Docker and the Container RevolutionDocker and the Container Revolution
Docker and the Container Revolution
 
Docker+java
Docker+javaDocker+java
Docker+java
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Development
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant
 

Recently uploaded

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

Intro to containerization

  • 1. INTRODUCTION TO CONTAINERIZATION BALINT PATO SOFTWARE CRAFTSMANSHIP NYC MEETUP 11/17/2016
  • 2. CURRICULUM FOR TODAY ▸ slides: curriculum ▸ hands-on: install docker, hello-world ▸ slides: containerization foundations ▸ hands-on: build an image from an app, run it, peak into the container ▸ slides: isolation and resource management ▸ hands-on: talking to the daemon, pushing the image to DockerHub, isolation experiments! ▸ discussion INTRODUCTION TO CONTAINERIZATION
  • 3. INTRODUCTION TO CONTAINERIZATION LET’S START HANDS-ON TEST > docker run hello-world
  • 4. INTRODUCTION TO CONTAINERIZATION WHAT IS CONTAINERIZATION? ▸ metaphor I.
 shipping container ▸ standard packaging ▸ isolation method ▸ composability
  • 5. INTRODUCTION TO CONTAINERIZATION WHAT IS CONTAINERIZATION? ▸ metaphor II.
 lightweight, fast virtualization ▸ a container is like a virtual machine but magnitudes faster to spin it up ▸ own networking stack ▸ own filesystem ▸ own process IDs ▸ …but it runs on a host machine!
  • 6. INTRODUCTION TO CONTAINERIZATION BENEFITS: WHAT ARE CONTAINERS GOOD FOR? ▸ repeatability: I build the image once, and deploy (roughly) the same thing prod ▸ portability: as long as the runtime is available for a platform, the container can run there too. ▸ reusable filesystem setup: layers are the base of reuse ▸ standard execution and distribution: most (I consider windows preview only) software stacks are supported ▸ density: I can deploy multiple instances next to each other and split up the resources
  • 7. INTRODUCTION TO CONTAINERIZATION BENEFITS: 
 CLOUD NATIVE ARCHITECTURE an important piece 
 in the cloud puzzle
  • 8. INTRODUCTION TO CONTAINERIZATION DEFINITIONS ▸ containerization platform: a family of technologies to isolate processes from each other, so that processes run as if they are running in a normal operating system while - enforced by the container runtime - they actually share the resources of a single host without having the ability to see each other's or the host's processes and resources. A platform also has opinion about the runtime and the lifecycle of the image, from building to distribution. 
 Examples: LXC, Rkt, Docker ▸ container runtime: container execution environment, which enforces the limited shares of resources (e.g. cpu, memory, disk) allocated to the containerized application, also exposes API and tools around managing containers. 
 Examples: LXD, Docker daemon, Rkt process ▸ image: an image defines the filesystem and execution parameters for the container. Images can be layered, composable, depending on the format. 
 Examples: Docker image, appc, LXC image format
  • 9. EXERCISE: LET’S BUILD AN IMAGE! INTRODUCTION TO CONTAINERIZATION FROM alpine RUN apk add --no-cache bash curl py-pip RUN pip install --upgrade pip RUN pip install flask COPY ./app.py / ENTRYPOINT python /app.py 2. create docker-start/Dockerfile with the following content > git clone https://github.com/balopat/docker-starter 1. get some sample code, discuss the flask app > docker build -t nanoservice . 3. build the image and discuss: What can these instructions mean?
  • 10. EXERCISE: LET’S RUN IT! INTRODUCTION TO CONTAINERIZATION > docker images 1. list images on your machine, discuss: what can you see? > docker run -d -p 1234:5000 nanoservice 2. spin up a container, discuss: what’s the output? > docker ps 3. list running containers, discuss the output > docker logs <container-id> 4. get the logs, discuss the output - try accessing the app
  • 11. EXERCISE: WHAT’S IN THE BOX? INTRODUCTION TO CONTAINERIZATION > docker exec <container-id> ls / 1. run this and discuss > docker exec -ti <container-id> bash 2. run this and experiment around container> ps ax 3. how many processes are in the container? what are their PIDs? container> curl localhost:5000 4. try accessing the app from inside
  • 12. INTRODUCTION TO CONTAINERIZATION KEEP IN MIND: THE DOCKER ARCHITECTURE: CLIENT-SERVER
  • 13. INTRODUCTION TO CONTAINERIZATION ISOLATION AND RESOURCE SHARING ▸ linux namespaces 
 http://man7.org/linux/man-pages/man7/namespaces.7.html ▸ hostname ▸ net ▸ pid ▸ users ▸ mounts ▸ … ▸ linux cgroups 
 https://en.wikipedia.org/wiki/Cgroups ▸ CPU share ▸ CPU set ▸ memory ▸ block I/O ▸ network priority ▸ …
  • 14. INTRODUCTION TO CONTAINERIZATION EXERCISE: PUNCH A WHOLE ON THE CONTAINER > docker run -d -p 1234:5000 nanoservice 1. spin up a container with port mapping and discuss: what’s the output? 
 what does docker ps show? 2. On Mac + Ubuntu desktops just access http://localhost:5000, [on Windows with Docker Toolbox: a.) find the boot2docker VM’s IP: run ‘docker-machine ls’ this will give you a tcp://<boot2dockerVMIP>:XXXX in the response b.) you can access the app at http://<boot2dockerVMIP>:1234
  • 15. INTRODUCTION TO CONTAINERIZATION https://hub.docker.com 1. Register on docker hub > docker login 2. login > docker tag nanoservice <username>/nanoservice 3. re-tag our service to setup the repository (check with docker images) > docker push <username>/nanoservice 4. push! EXERCISE: PUSH IT TO DOCKERHUB
  • 16. EXERCISE: TALKING TO THE DAEMON INTRODUCTION TO CONTAINERIZATION > docker run -it --privileged -v /var/run/docker.sock:/var/ run/docker.sock appropriate/curl sh > curl google.com 1. we’ll need curl > ls /var/run/docker.sock 2. find /var/run/docker.sock > curl --unix-socket /var/run/docker.sock http://localhost/images/json 3. let’s query the daemon!
  • 17. EXERCISE: LIMIT MEMORY INTRODUCTION TO CONTAINERIZATION > docker run -ti -m 300M debian bash 1.Let’s get a shell limited to 300M of memory > docker stats 2. another window, let’s see the amount of RAM you have! https://docs.docker.com/engine/reference/run/ Loads of options to manage resource usage of apps: > cat <(yes | tr n x | head -c $((1024*1024*300))) <(sleep 10) | grep n 3. let’s load stuff in the memory, follow the action in the docker stats!
  • 18. EXERCISE: MAX OUT YOUR CPU - ONLY DO THIS IF YOU HAVE MORE THAN 1 CORE! INTRODUCTION TO CONTAINERIZATION > docker run -ti --cpuset-cpus="1" --cpu-quota=10000 debian bash 1.Let’s get a shell limited to 1 cpu and only 10% of it > :(){ :|:& };: 2. Let’s drop the fork bomb > docker stats 3. on another tab - let’s see the stats > docker kill <container-id> 4. kill the cpu killer
  • 19. CURRICULUM FOR TODAY ▸ slides: curriculum ▸ hands-on: install docker, hello-world ▸ slides: containerization foundations ▸ hands-on: build an image from an app, run it, peak into the container ▸ slides: isolation and resource management ▸ hands-on: talking to the daemon, pushing the image to DockerHub, isolation experiments! ▸ well done! we can get to the discussion :) INTRODUCTION TO CONTAINERIZATION