SlideShare a Scribd company logo
1 of 23
Download to read offline
Docker: Up and Running
Mark Beacom
Introduction
Mark Beacom
● With Drund since July 2014
● Recently moved to DevOps from Backend
● I like coffee
● Rather be camping
What I’ll cover...
● What’s Docker?
● Benefits of Docker
● Images and Containers?
● The Docker ecosystem
● Dockerizing a flask web app
● Honorable mentions
● Live streaming: A resource intensive animal
What’s Docker?
● “Docker is the world’s leading software container platform.”
● Established in 2008
● Current release: v1.13
● Github: 43K+ Stars (now moby/moby)
● Software platform allowing for rapid build, test, and deploy of
applications
● Packages software into standardized units called containers
● Runs images of containers
● Wraps everything needed to run: code, runtime, system tools, system
libraries - anything that can be installed on a server
Benefits of Docker
● Avoid: “Works on my machine” problems when
collaborating on code
● Ship Software… Faster (7x)
● Improved Developer Productivity
● Easy deployment, scaling, and rollbacks
● Avoid: Application configuration drift
● Reusability!
Images...
● Lightweight
● Stand-alone
● Executable
● Immutable
● Created with: docker build
● Listed with: docker images
● Deployable to registries
● Generated from a Dockerfile definition
The basis of a Docker container
Containers..? What’s a container?
● Runtime instance of an image
● The standard unit where the application or service resides
● Runs completely isolated from the host environment (unless configured)
● Runs natively on the host machine’s kernel
● Created with: docker run
Docker CLI
● Listing active containers: docker ps
● Listing images: docker images
● Pulling images: docker pull alpine
○ Retrieves the alpine linux image from the Docker Hub repository
● Running an image: docker run alpine ls
○ Spins up a docker container running alpine with the ls command and returns the
response.
Dockerize a Flask webapp!
● Collect the project source - We’re using Docker’s flask app example
https://github.com/docker/labs/tree/master/beginner/flask-app
● Runs a python-based web application serving a single index template
● Defines all requirements, libraries, and configuration settings.
Anatomy of our Dockerfile
● FROM - Defines the base
● RUN - Executes commands during
the build process
● COPY - Copies file(s) to the image
● EXPOSE - Exposes the port
● CMD - The default command
executed at runtime
Initiating a Docker build...
docker build -t docker-demo .
● Results in a build with 9 steps
● Pulls the Alpine linux image from Docker
Hub
● Runs our commands
● Copies assets
● Exposes the necessary port to the host
Building the image
● Step 1: FROM alpine:latest
● Step 2: RUN apk add --update py2-pip
Building the image
● Step 3: RUN pip install --upgrade pip
● Step 4: COPY requirements.txt /usr/src/app/
Building the image
● Step 5: RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt
Building the image
● Step 6: COPY app.py /usr/src/app/
● Step 7: COPY templates/index.html /usr/src/app/templates/
● Step 8: EXPOSE 5000
Building the image
● Step 9: CMD python /usr/src/app/app.py
Running the container
● Mapping ports at runtime:
○ docker run -p 4000:5000 docker-demo
○ -p <host_port>:<container_port>
○ If no port is specified, a host port will be assigned randomly
● Naming the container for easier access and differentiation
○ docker run -p 4000:5000 --name demo docker-demo
○ --name <name>
○ If not specified, Docker will assign a random name to the container instance
Cleaning up...
● List Docker containers: docker ps
● Stop a running container: docker stop <name_or_hash>
● Remove a stopped container: docker rm <name_or_hash>
● List images: docker images
● Remove an unused image: docker rmi <name_or_hash>
A better way…
● docker run with --rm
● Automatically removes the container on exit
Live Demo
Risky business… Let’s try it out!
Honorable Mentions
● Docker Compose
○ Defining a whole containerized workload in a single file definition
● Task Schedulers and Container Orchestration
○ Marathon, Amazon ECS, Rancher, Nomad
Our use case for live streaming
● Deployed to Amazon Elastic Container Service
● Dynamically scales underlying resource pool based on utilization
● Individual transcoding containers independent for each stream
● Only use resources when the platform is in use
● Live stream capacity only limited by the maximum number of
instances we can provision on AWS
Question and Answer

More Related Content

What's hot

Docker
DockerDocker
Dockersubbul
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerKuan Yen Heng
 
Virtual Machines and Docker
Virtual Machines and DockerVirtual Machines and Docker
Virtual Machines and DockerDanish Khakwani
 
Docker - Build, Ship, and Run Any App, Anywhere
Docker - Build, Ship, and Run Any App, AnywhereDocker - Build, Ship, and Run Any App, Anywhere
Docker - Build, Ship, and Run Any App, AnywhereCodibly - Software House
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?Izzet Mustafaiev
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker ComposeJustin Crown
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and dockerDuckDuckGo
 
Docker session I: Continuous integration, delivery and deployment
Docker session I: Continuous integration, delivery and deploymentDocker session I: Continuous integration, delivery and deployment
Docker session I: Continuous integration, delivery and deploymentDegendra Sivakoti
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Binary Studio
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing dockerSascha Brinkmann
 
Docker Compose and Panamax - ContainerDays Boston - June 2015
Docker Compose and Panamax - ContainerDays Boston - June 2015Docker Compose and Panamax - ContainerDays Boston - June 2015
Docker Compose and Panamax - ContainerDays Boston - June 2015Jonas Rosland
 
Continuous Delivery di una WebApp - by example
Continuous Delivery di una WebApp - by exampleContinuous Delivery di una WebApp - by example
Continuous Delivery di una WebApp - by exampleFabio Mora
 
Dockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspaceDockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspacedotCloud
 
Docker Ecosystem: Part III - Machine
Docker Ecosystem: Part III - MachineDocker Ecosystem: Part III - Machine
Docker Ecosystem: Part III - MachineMario IC
 
From Docker Run To Docker Compose
From Docker Run To Docker ComposeFrom Docker Run To Docker Compose
From Docker Run To Docker ComposeFitra Aditya
 

What's hot (20)

Docker
DockerDocker
Docker
 
Surveillance on slam technology
Surveillance on slam technologySurveillance on slam technology
Surveillance on slam technology
 
Docker e git lab
Docker e git labDocker e git lab
Docker e git lab
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Virtual Machines and Docker
Virtual Machines and DockerVirtual Machines and Docker
Virtual Machines and Docker
 
Docker - Build, Ship, and Run Any App, Anywhere
Docker - Build, Ship, and Run Any App, AnywhereDocker - Build, Ship, and Run Any App, Anywhere
Docker - Build, Ship, and Run Any App, Anywhere
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker Compose
 
CI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOWCI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOW
 
Lando - AddWeb Solution
Lando - AddWeb Solution Lando - AddWeb Solution
Lando - AddWeb Solution
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 
Docker session I: Continuous integration, delivery and deployment
Docker session I: Continuous integration, delivery and deploymentDocker session I: Continuous integration, delivery and deployment
Docker session I: Continuous integration, delivery and deployment
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
 
CI CD WORKFLOW
CI CD WORKFLOWCI CD WORKFLOW
CI CD WORKFLOW
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing docker
 
Docker Compose and Panamax - ContainerDays Boston - June 2015
Docker Compose and Panamax - ContainerDays Boston - June 2015Docker Compose and Panamax - ContainerDays Boston - June 2015
Docker Compose and Panamax - ContainerDays Boston - June 2015
 
Continuous Delivery di una WebApp - by example
Continuous Delivery di una WebApp - by exampleContinuous Delivery di una WebApp - by example
Continuous Delivery di una WebApp - by example
 
Dockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspaceDockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at Rackspace
 
Docker Ecosystem: Part III - Machine
Docker Ecosystem: Part III - MachineDocker Ecosystem: Part III - Machine
Docker Ecosystem: Part III - Machine
 
From Docker Run To Docker Compose
From Docker Run To Docker ComposeFrom Docker Run To Docker Compose
From Docker Run To Docker Compose
 

Similar to Docker Up and Running Introduction

Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tipsSamuel Chow
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday developmentJustyna Ilczuk
 
Docker in a JS Developer’s Life
Docker in a JS Developer’s LifeDocker in a JS Developer’s Life
Docker in a JS Developer’s LifeGlobalLogic Ukraine
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Binary Studio
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerGuido Schmutz
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeDr. Ketan Parmar
 
Docker 101: An Introduction
Docker 101: An IntroductionDocker 101: An Introduction
Docker 101: An IntroductionPOSSCON
 
Docker slides
Docker slidesDocker slides
Docker slidesAyla Khan
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'acorehard_by
 

Similar to Docker Up and Running Introduction (20)

Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker in a JS Developer’s Life
Docker in a JS Developer’s LifeDocker in a JS Developer’s Life
Docker in a JS Developer’s Life
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
Docker basic
Docker basicDocker basic
Docker basic
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
 
DOCKER-PIAIC-SLIDES
DOCKER-PIAIC-SLIDESDOCKER-PIAIC-SLIDES
DOCKER-PIAIC-SLIDES
 
How to _docker
How to _dockerHow to _docker
How to _docker
 
Docker.pdf
Docker.pdfDocker.pdf
Docker.pdf
 
Docker presentation
Docker presentationDocker presentation
Docker presentation
 
Docker+java
Docker+javaDocker+java
Docker+java
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
 
Docker 101: An Introduction
Docker 101: An IntroductionDocker 101: An Introduction
Docker 101: An Introduction
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker slides
Docker slidesDocker slides
Docker slides
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 

Recently uploaded

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 

Recently uploaded (20)

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 

Docker Up and Running Introduction

  • 1. Docker: Up and Running Mark Beacom
  • 2. Introduction Mark Beacom ● With Drund since July 2014 ● Recently moved to DevOps from Backend ● I like coffee ● Rather be camping
  • 3. What I’ll cover... ● What’s Docker? ● Benefits of Docker ● Images and Containers? ● The Docker ecosystem ● Dockerizing a flask web app ● Honorable mentions ● Live streaming: A resource intensive animal
  • 4. What’s Docker? ● “Docker is the world’s leading software container platform.” ● Established in 2008 ● Current release: v1.13 ● Github: 43K+ Stars (now moby/moby) ● Software platform allowing for rapid build, test, and deploy of applications ● Packages software into standardized units called containers ● Runs images of containers ● Wraps everything needed to run: code, runtime, system tools, system libraries - anything that can be installed on a server
  • 5.
  • 6. Benefits of Docker ● Avoid: “Works on my machine” problems when collaborating on code ● Ship Software… Faster (7x) ● Improved Developer Productivity ● Easy deployment, scaling, and rollbacks ● Avoid: Application configuration drift ● Reusability!
  • 7. Images... ● Lightweight ● Stand-alone ● Executable ● Immutable ● Created with: docker build ● Listed with: docker images ● Deployable to registries ● Generated from a Dockerfile definition The basis of a Docker container
  • 8. Containers..? What’s a container? ● Runtime instance of an image ● The standard unit where the application or service resides ● Runs completely isolated from the host environment (unless configured) ● Runs natively on the host machine’s kernel ● Created with: docker run
  • 9. Docker CLI ● Listing active containers: docker ps ● Listing images: docker images ● Pulling images: docker pull alpine ○ Retrieves the alpine linux image from the Docker Hub repository ● Running an image: docker run alpine ls ○ Spins up a docker container running alpine with the ls command and returns the response.
  • 10. Dockerize a Flask webapp! ● Collect the project source - We’re using Docker’s flask app example https://github.com/docker/labs/tree/master/beginner/flask-app ● Runs a python-based web application serving a single index template ● Defines all requirements, libraries, and configuration settings.
  • 11. Anatomy of our Dockerfile ● FROM - Defines the base ● RUN - Executes commands during the build process ● COPY - Copies file(s) to the image ● EXPOSE - Exposes the port ● CMD - The default command executed at runtime
  • 12. Initiating a Docker build... docker build -t docker-demo . ● Results in a build with 9 steps ● Pulls the Alpine linux image from Docker Hub ● Runs our commands ● Copies assets ● Exposes the necessary port to the host
  • 13. Building the image ● Step 1: FROM alpine:latest ● Step 2: RUN apk add --update py2-pip
  • 14. Building the image ● Step 3: RUN pip install --upgrade pip ● Step 4: COPY requirements.txt /usr/src/app/
  • 15. Building the image ● Step 5: RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt
  • 16. Building the image ● Step 6: COPY app.py /usr/src/app/ ● Step 7: COPY templates/index.html /usr/src/app/templates/ ● Step 8: EXPOSE 5000
  • 17. Building the image ● Step 9: CMD python /usr/src/app/app.py
  • 18. Running the container ● Mapping ports at runtime: ○ docker run -p 4000:5000 docker-demo ○ -p <host_port>:<container_port> ○ If no port is specified, a host port will be assigned randomly ● Naming the container for easier access and differentiation ○ docker run -p 4000:5000 --name demo docker-demo ○ --name <name> ○ If not specified, Docker will assign a random name to the container instance
  • 19. Cleaning up... ● List Docker containers: docker ps ● Stop a running container: docker stop <name_or_hash> ● Remove a stopped container: docker rm <name_or_hash> ● List images: docker images ● Remove an unused image: docker rmi <name_or_hash> A better way… ● docker run with --rm ● Automatically removes the container on exit
  • 20. Live Demo Risky business… Let’s try it out!
  • 21. Honorable Mentions ● Docker Compose ○ Defining a whole containerized workload in a single file definition ● Task Schedulers and Container Orchestration ○ Marathon, Amazon ECS, Rancher, Nomad
  • 22. Our use case for live streaming ● Deployed to Amazon Elastic Container Service ● Dynamically scales underlying resource pool based on utilization ● Individual transcoding containers independent for each stream ● Only use resources when the platform is in use ● Live stream capacity only limited by the maximum number of instances we can provision on AWS