SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to KubernetesImesh Gunaratne
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Herofazalraja
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for BeginnersOktay Esgul
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017Docker, Inc.
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetesMichal Cwienczek
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideBytemark
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetesDongwon Kim
 
Docker and the Linux Kernel
Docker and the Linux KernelDocker and the Linux Kernel
Docker and the Linux KernelDocker, Inc.
 
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
 
virtualization-vs-containerization-paas
virtualization-vs-containerization-paasvirtualization-vs-containerization-paas
virtualization-vs-containerization-paasrajdeep
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)Gourav Varma
 
Kubernetes
KubernetesKubernetes
Kuberneteserialc_w
 
Dockers and kubernetes
Dockers and kubernetesDockers and kubernetes
Dockers and kubernetesDr Ganesh Iyer
 
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1Etsuji Nakai
 
Software Containerization
Software ContainerizationSoftware Containerization
Software ContainerizationRoshan Deniyage
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetesRishabh Indoria
 
Container orchestration overview
Container orchestration overviewContainer orchestration overview
Container orchestration overviewWyn B. Van Devanter
 

Tendances (20)

Docker basics
Docker basicsDocker basics
Docker basics
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for Beginners
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 
Docker
DockerDocker
Docker
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 
Docker and the Linux Kernel
Docker and the Linux KernelDocker and the Linux Kernel
Docker and the Linux Kernel
 
kubernetes, pourquoi et comment
kubernetes, pourquoi et commentkubernetes, pourquoi et comment
kubernetes, pourquoi et comment
 
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
 
virtualization-vs-containerization-paas
virtualization-vs-containerization-paasvirtualization-vs-containerization-paas
virtualization-vs-containerization-paas
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Dockers and kubernetes
Dockers and kubernetesDockers and kubernetes
Dockers and kubernetes
 
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
 
Software Containerization
Software ContainerizationSoftware Containerization
Software Containerization
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Container orchestration overview
Container orchestration overviewContainer orchestration overview
Container orchestration overview
 

En vedette

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
 
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
 
[3] ptk 2014 2015 ship types
[3] ptk 2014 2015 ship types[3] ptk 2014 2015 ship types
[3] ptk 2014 2015 ship typesSyaifullah Hamim
 

En vedette (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
 
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
 
[3] ptk 2014 2015 ship types
[3] ptk 2014 2015 ship types[3] ptk 2014 2015 ship types
[3] ptk 2014 2015 ship types
 

Similaire à 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
 

Similaire à 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
 

Dernier

VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 

Dernier (20)

VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 

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