SlideShare ist ein Scribd-Unternehmen logo
1 von 47
DOCKER
INTRODUCTION
DATA SCIENCE FOCUSED
Agenda
 Containers Basics
 Example
 Definitions
 History of containers
 Why Docker?
 How Docker containers work
 Namespaces
 cGroups
 Union file system
 Containers vs. VMs
 Docker tooling/Architecture
 Dockerfile
 Image / Registry
 Containers
 Workflow
 simple ML model behind a flask API with python
 write effective docker files
 distribute containers
 Data-science tooling
 Running a Jupyter Notebook
 Load and Run a Database
 Advanced Docker concepts
 Docker compose
 DevOps workflow
 Continuous Delivery
 Kubernetes
Training Setup
 3 VM on AWS cloud - Ubuntu 18:04
 For exercises:
 https://docs.docker.com/docker-for-windows/
 Repository
 https://github.com/kirancodify/docker-for-data-science
Container Basics
 Example Demo
Container Basics - Definitions
 Docker defines containers as "A standardized unit of software"
 Amazon defines containers as "Containers provide a standard way to package your application's code, configurations, and
dependencies into a single object."
 Google defines containers as "Containers offer a logical packaging mechanism in which applications can be abstracted
from the environment in which they actually run."
 Developers.com defines containers as "Container technology is a way to create a virtual environment by using an isolated
process on a host computer. The isolated process, the container, has its own set of file system resources and subordinate
processes."
Container Basics - Intent
 Resource Utilization - CPU, Memory were expensive resources
 Multi user operating system - People on same hardware had to have file process isolation
Container Basics - History
 https://de.slideshare.net/Pivotal/the-history-44807468
Container
Basics – Why
Docker
 Docker is the most popular brand
in the Container space!!
 Consistent Runtime Environment
Container
Basics – Why
Docker
 Run Anywhere
 You’ll see the shipping container
analog quite a bit.Shipping
containers standardized the
logistics industry
 There is a standard format for
containers. Don’t matter what’s
inside. We can send it by boat, by
rail, or by truck.
 Have infrastructure to handle
Container
Basics – Why
Docker
 Isolation
 Monolith - SOA - Microservices
 With software containers, we
package code + everything
required to make our software run
into an isolated container
 Since the container is
it can be shipped off into
production environments without
having to worry if it will run or not
Container Basics – Why Docker
 Efficient Resource Utilization
 In this paradigm, each container is given a fixed resource configuration (CPU, RAM, # of threads, etc) and scaling the application requires
scaling just the number of containers instead of the individual resource primitives. This provides a much easier abstraction for engineers
when applications need to be scaled up or down.
 Microservice Architecture
 Containers also serve as a great tool to implement micro service architecture, where each microservice is just a set of co-operating
containers. Makes scalable application. Flexible for use.
 Virtualization
 Containers provide the system with a virtualized environment that can hide or limit the visibility of the physical devices or system's
configuration underneath it.
Container Basics – How Docker Works
 Namespaces
 Namespaces are commonly structured as hierarchies to allow reuse of names in different contexts
 https://www.toptal.com/linux/separation-anxiety-isolating-your-system-with-linux-namespaces
 The pid namespace: Process isolation (PID: Process ID).
 The net namespace: Managing network interfaces (NET: Networking).
 The ipc namespace: Managing access to IPC resources (IPC: InterProcess Communication).
 The mnt namespace: Managing filesystem mount points (MNT: Mount).
 The uts namespace: Isolating kernel and version identifiers. (UTS: Unix Timesharing System).
 The user namespace: Root access for isolated process
Container Basics
– How Docker
Works
Container Basics – How Docker Works
Cgroups
Container Basics – How Docker Works
 Union file system
Example:
layer 1: /bin/sh, /bin/cp, /bin/cd
layer 2: /bin/cd
layer 3: /bin/zsh
result: /bin/sh, /bin/cp, /bin/cd (from layer 2), /bin/zsh
CONTAINERS VS VM
DOCKER TOOLING/ARCHITECTURE
DOCKER ARCHITECTURE: OVERVIEW
COMPONENTS
DOCKER FILE
 Sequential set of instruction intended to be processed by Docker
daemon/engine
 Primary way of interacting with docker
 Order of sequence is important
 Each instruction creates a layer
 Layers are cached and reused by Docker
 Name the file Dockerfile with no extensions
Show Dockerfile demo
DOCKER IMAGE
 A Docker image is made up of multiple layers.
 A user composes each Docker image to include system libraries,
tools, and other files and dependencies for the executable code.
 Image developers can reuse static image layers for different
projects. Reuse saves time, because a user does not have to create
everything in an image.
 Most Docker images start with a base image, although a user can
build one entirely from scratch, if desired.
 Each image has one readable/writable top layer over static layers.
DOCKER IMAGE
DOCKER IMAGE
DOCKER
CONTAINERS
 Running instance of a docker image
 Light weight with complete isolation
 Containers can talk to each other via IPs and DNS
 Run simply means allocating CPU, Memory and Storage resources
 Setup port forwarding to connect to containers
 $ docker run -p 9000:8888
 Add a volume mount
 docker run -v /full/local/path:/mounted_dir
DOCKER CONTAINERS
EXERCISE DOCKER BASICS AND DOCKER
FILE
WORKFLOW
PUTTING PIECES TOGETHER DURING REAL
TIME DEVELOPMENT SCENARIO
 Create a ML module in Python with the ability to predict house prices (Y), based on the square feets as input parameter
(X)
 Create a simple HTTP REST-API on top of your ML module that takes X as parameter for the request and responds with
prediction Y1
 Create a docker image
 Augment the app in a container and ship the image across to a different host and run the container there.
BEST PRACTICES
 Why do I care how many layers I have?
 More layers mean a larger image. The larger the image, the longer that it takes to both build, and push and pull from a registry.
 Smaller images mean faster builds and deploys. This also means a smaller attack surface.
 Sharing is caring.
 Use shared base images where possible
 Limit the data written to the container layer
 Chain RUN statements
 Prevent cache misses at build for as long as possible
BEST
PRACTICES
 Choose a better distro
EXERCISE : FORM SMALL GROUPS AND
BRAINSTORM HOW DOCKER WILL FIT INTO
YOUR DAY TO DAY WORKFLOW.
DATA SCIENCE TOOLING
JUPYTER NOTEBOOKS + DOCKER
 Ready-to-run Docker images containing Jupyter applications https://jupyter-docker-
stacks.readthedocs.io/en/latest/using/selecting.html
 https://github.com/jupyter/docker-stacks
JUPYTER
NOTEBOOKS +
DOCKER
DATA ACCESS USING DATA SCIENCE-
NOTEBOOK
 Demo Multiple containers.
 Write read data to redis db container
 Read data from Postgres container
ADVANCED DOCKER CONCEPTS
DOCKER COMPOSE
DOCKER COMPOSE
DOCKER COMPOSE
DEVOPS WORKFLOW
 At its essence, DevOps is a culture, a movement, a philosophy.
 Tearing down barriers
 Between teams
 Mid-process
 Enable the smart people to make smart decisions
 Assigning ownership, accountability, responsibility to the people doing the work, aka “you build it, you run it”
 Reducing responsibility to the most directly involved individuals
 Increase visibility to the big picture and the results of work being done
DEVOPS WORKFLOW
 Practices
 Continuous Integration
 Application testing/QA work applied throughout the development
 Continuous Delivery
 Automated deployment capabilities of code across environments
 Infrastructure as Code
 No hand carved infrastructure
 Self-service environments
 Remove procurement blockers for basic needs
 Microservices
 Break down complicated monolithic applications in to smaller ones
DEVOPS WORKFLOW
CONTINUOUS INTEGRATION
KUBERNETES
QUESTIONS
AND FEEDBACK

Weitere ähnliche Inhalte

Was ist angesagt?

Microservices. Microservices everywhere! (At OSCON 2015)
Microservices. Microservices everywhere! (At OSCON 2015)Microservices. Microservices everywhere! (At OSCON 2015)
Microservices. Microservices everywhere! (At OSCON 2015)
Jérôme Petazzoni
 

Was ist angesagt? (20)

Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and Azure
 
Understanding the container landscape and it associated projects
Understanding the container landscape and it associated projectsUnderstanding the container landscape and it associated projects
Understanding the container landscape and it associated projects
 
Containerization Report
Containerization ReportContainerization Report
Containerization Report
 
Deploy microservices in containers with Docker and friends - KCDC2015
Deploy microservices in containers with Docker and friends - KCDC2015Deploy microservices in containers with Docker and friends - KCDC2015
Deploy microservices in containers with Docker and friends - KCDC2015
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Docker: Aspects of Container Isolation
Docker: Aspects of Container IsolationDocker: Aspects of Container Isolation
Docker: Aspects of Container Isolation
 
Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?
 
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...
 
Docker Dojo
Docker DojoDocker Dojo
Docker Dojo
 
Introduction To Docker
Introduction To  DockerIntroduction To  Docker
Introduction To Docker
 
Docker Presentation
Docker PresentationDocker Presentation
Docker Presentation
 
Docker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshopDocker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshop
 
Microservices. Microservices everywhere! (At OSCON 2015)
Microservices. Microservices everywhere! (At OSCON 2015)Microservices. Microservices everywhere! (At OSCON 2015)
Microservices. Microservices everywhere! (At OSCON 2015)
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special EditionIntroduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbies
 
Tokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityTokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker Security
 
Docker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing MeetupDocker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing Meetup
 
24 23 jun17 2may17 16231 ijeecs latest_version (1) edit septian
24 23 jun17 2may17 16231 ijeecs latest_version (1) edit septian24 23 jun17 2may17 16231 ijeecs latest_version (1) edit septian
24 23 jun17 2may17 16231 ijeecs latest_version (1) edit septian
 
The building blocks of docker.
The building blocks of docker.The building blocks of docker.
The building blocks of docker.
 

Ähnlich wie Docker training

Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deployment
javaonfly
 

Ähnlich wie Docker training (20)

Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with Docker
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with Docker
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
Axigen on docker
Axigen on dockerAxigen on docker
Axigen on docker
 
Quick Trip with Docker
Quick Trip with DockerQuick Trip with Docker
Quick Trip with Docker
 
Docker 101 Checonf 2016
Docker 101 Checonf 2016Docker 101 Checonf 2016
Docker 101 Checonf 2016
 
Backend Master | 3.4.2 Deploy - Docker Introduction
Backend Master | 3.4.2 Deploy - Docker IntroductionBackend Master | 3.4.2 Deploy - Docker Introduction
Backend Master | 3.4.2 Deploy - Docker Introduction
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
 
Docker DANS workshop
Docker DANS workshopDocker DANS workshop
Docker DANS workshop
 
Docker_Interview_Questions__Answers.pdf
Docker_Interview_Questions__Answers.pdfDocker_Interview_Questions__Answers.pdf
Docker_Interview_Questions__Answers.pdf
 
Docker handons-workshop-for-charity
Docker handons-workshop-for-charityDocker handons-workshop-for-charity
Docker handons-workshop-for-charity
 
HPC Cloud Burst Using Docker
HPC Cloud Burst Using DockerHPC Cloud Burst Using Docker
HPC Cloud Burst Using Docker
 
Docker Application to Scientific Computing
Docker Application to Scientific ComputingDocker Application to Scientific Computing
Docker Application to Scientific Computing
 
Docker, Cloud Foundry, Bosh & Bluemix
Docker, Cloud Foundry, Bosh & BluemixDocker, Cloud Foundry, Bosh & Bluemix
Docker, Cloud Foundry, Bosh & Bluemix
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Weave User Group Talk - DockerCon 2017 Recap
Weave User Group Talk - DockerCon 2017 RecapWeave User Group Talk - DockerCon 2017 Recap
Weave User Group Talk - DockerCon 2017 Recap
 
Docker 1.9 Workshop
Docker 1.9 WorkshopDocker 1.9 Workshop
Docker 1.9 Workshop
 
Powering Microservices with Docker
Powering Microservices with DockerPowering Microservices with Docker
Powering Microservices with Docker
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deployment
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

Docker training

  • 2. Agenda  Containers Basics  Example  Definitions  History of containers  Why Docker?  How Docker containers work  Namespaces  cGroups  Union file system  Containers vs. VMs  Docker tooling/Architecture  Dockerfile  Image / Registry  Containers  Workflow  simple ML model behind a flask API with python  write effective docker files  distribute containers  Data-science tooling  Running a Jupyter Notebook  Load and Run a Database  Advanced Docker concepts  Docker compose  DevOps workflow  Continuous Delivery  Kubernetes
  • 3. Training Setup  3 VM on AWS cloud - Ubuntu 18:04  For exercises:  https://docs.docker.com/docker-for-windows/  Repository  https://github.com/kirancodify/docker-for-data-science
  • 5. Container Basics - Definitions  Docker defines containers as "A standardized unit of software"  Amazon defines containers as "Containers provide a standard way to package your application's code, configurations, and dependencies into a single object."  Google defines containers as "Containers offer a logical packaging mechanism in which applications can be abstracted from the environment in which they actually run."  Developers.com defines containers as "Container technology is a way to create a virtual environment by using an isolated process on a host computer. The isolated process, the container, has its own set of file system resources and subordinate processes."
  • 6. Container Basics - Intent  Resource Utilization - CPU, Memory were expensive resources  Multi user operating system - People on same hardware had to have file process isolation
  • 7. Container Basics - History  https://de.slideshare.net/Pivotal/the-history-44807468
  • 8. Container Basics – Why Docker  Docker is the most popular brand in the Container space!!  Consistent Runtime Environment
  • 9. Container Basics – Why Docker  Run Anywhere  You’ll see the shipping container analog quite a bit.Shipping containers standardized the logistics industry  There is a standard format for containers. Don’t matter what’s inside. We can send it by boat, by rail, or by truck.  Have infrastructure to handle
  • 10. Container Basics – Why Docker  Isolation  Monolith - SOA - Microservices  With software containers, we package code + everything required to make our software run into an isolated container  Since the container is it can be shipped off into production environments without having to worry if it will run or not
  • 11. Container Basics – Why Docker  Efficient Resource Utilization  In this paradigm, each container is given a fixed resource configuration (CPU, RAM, # of threads, etc) and scaling the application requires scaling just the number of containers instead of the individual resource primitives. This provides a much easier abstraction for engineers when applications need to be scaled up or down.  Microservice Architecture  Containers also serve as a great tool to implement micro service architecture, where each microservice is just a set of co-operating containers. Makes scalable application. Flexible for use.  Virtualization  Containers provide the system with a virtualized environment that can hide or limit the visibility of the physical devices or system's configuration underneath it.
  • 12. Container Basics – How Docker Works  Namespaces  Namespaces are commonly structured as hierarchies to allow reuse of names in different contexts  https://www.toptal.com/linux/separation-anxiety-isolating-your-system-with-linux-namespaces  The pid namespace: Process isolation (PID: Process ID).  The net namespace: Managing network interfaces (NET: Networking).  The ipc namespace: Managing access to IPC resources (IPC: InterProcess Communication).  The mnt namespace: Managing filesystem mount points (MNT: Mount).  The uts namespace: Isolating kernel and version identifiers. (UTS: Unix Timesharing System).  The user namespace: Root access for isolated process
  • 13. Container Basics – How Docker Works
  • 14. Container Basics – How Docker Works Cgroups
  • 15. Container Basics – How Docker Works  Union file system Example: layer 1: /bin/sh, /bin/cp, /bin/cd layer 2: /bin/cd layer 3: /bin/zsh result: /bin/sh, /bin/cp, /bin/cd (from layer 2), /bin/zsh
  • 16.
  • 17.
  • 22. DOCKER FILE  Sequential set of instruction intended to be processed by Docker daemon/engine  Primary way of interacting with docker  Order of sequence is important  Each instruction creates a layer  Layers are cached and reused by Docker  Name the file Dockerfile with no extensions Show Dockerfile demo
  • 23. DOCKER IMAGE  A Docker image is made up of multiple layers.  A user composes each Docker image to include system libraries, tools, and other files and dependencies for the executable code.  Image developers can reuse static image layers for different projects. Reuse saves time, because a user does not have to create everything in an image.  Most Docker images start with a base image, although a user can build one entirely from scratch, if desired.  Each image has one readable/writable top layer over static layers.
  • 26. DOCKER CONTAINERS  Running instance of a docker image  Light weight with complete isolation  Containers can talk to each other via IPs and DNS  Run simply means allocating CPU, Memory and Storage resources  Setup port forwarding to connect to containers  $ docker run -p 9000:8888  Add a volume mount  docker run -v /full/local/path:/mounted_dir
  • 28. EXERCISE DOCKER BASICS AND DOCKER FILE
  • 30. PUTTING PIECES TOGETHER DURING REAL TIME DEVELOPMENT SCENARIO  Create a ML module in Python with the ability to predict house prices (Y), based on the square feets as input parameter (X)  Create a simple HTTP REST-API on top of your ML module that takes X as parameter for the request and responds with prediction Y1  Create a docker image  Augment the app in a container and ship the image across to a different host and run the container there.
  • 31. BEST PRACTICES  Why do I care how many layers I have?  More layers mean a larger image. The larger the image, the longer that it takes to both build, and push and pull from a registry.  Smaller images mean faster builds and deploys. This also means a smaller attack surface.  Sharing is caring.  Use shared base images where possible  Limit the data written to the container layer  Chain RUN statements  Prevent cache misses at build for as long as possible
  • 33. EXERCISE : FORM SMALL GROUPS AND BRAINSTORM HOW DOCKER WILL FIT INTO YOUR DAY TO DAY WORKFLOW.
  • 35. JUPYTER NOTEBOOKS + DOCKER  Ready-to-run Docker images containing Jupyter applications https://jupyter-docker- stacks.readthedocs.io/en/latest/using/selecting.html  https://github.com/jupyter/docker-stacks
  • 37. DATA ACCESS USING DATA SCIENCE- NOTEBOOK  Demo Multiple containers.  Write read data to redis db container  Read data from Postgres container
  • 42. DEVOPS WORKFLOW  At its essence, DevOps is a culture, a movement, a philosophy.  Tearing down barriers  Between teams  Mid-process  Enable the smart people to make smart decisions  Assigning ownership, accountability, responsibility to the people doing the work, aka “you build it, you run it”  Reducing responsibility to the most directly involved individuals  Increase visibility to the big picture and the results of work being done
  • 43. DEVOPS WORKFLOW  Practices  Continuous Integration  Application testing/QA work applied throughout the development  Continuous Delivery  Automated deployment capabilities of code across environments  Infrastructure as Code  No hand carved infrastructure  Self-service environments  Remove procurement blockers for basic needs  Microservices  Break down complicated monolithic applications in to smaller ones

Hinweis der Redaktion

  1. Docker for Windows still uses a Linux VM to run Linux containers. But instead of using Virtual Box (which is what is used with Docker Toolbox), the Linux VM is run using Hyper-V - a Windows-native hypervisor. This means that Docker for Windows ships fewer components and has less moving parts.
  2. Show demo of docker installation Run Jupyter notebook Get versions of python packages Show python version
  3. Isolated process on the OS
  4. the chroot system call was introduced, changing the root directory of a process and its children to a new location in the filesystem.
  5. Docker started as a project to build single-application LXC containers, introducing several changes to LXC that make containers more portable and flexible to use. It later morphed into its own container runtime environment. At a high level, Docker is a Linux utility that can efficiently create, ship, and run containers.
  6. Part of the magic that allows multiple containers to run on the same operating system is called Linux Control Groups (cgroups). Cgroups limit the amount of resources a process can consume (CPU, memory, network bandwidth, etc.) and as far as the container knows, it’s running on an independent machine. More importantly, this container can’t hog all the resources reserved for other containers. https://docs.docker.com/v17.09/engine/admin/resource_constraints/
  7. It allows files and directories of separate file systems overlaid one by one, forming a final single coherent file system. The benefit of using layered file system is that multiple images can share the same layer and thus it reduces the size of disk needed. Note that when a container is created, a writable layer is also created on top of the image layers.
  8. The cool part is if there are two containers with the image layers a, b, c and a, b, d, then you only need to store one copy of each image layer a, b, c, d both locally and in the repository. This is Docker’s union file system. Docker Storage Drivers - Overlay2 Drivers - Docker Images and Dockerfile - Copy on Write operation
  9. Light weight: less memory and storage Easier to ship Works anywhere Cost efficient and easy to scale
  10. Docker client is where we enter commands to interact with Docker Commands go to Docker Host (which can be either local or remote) which is running the Docker daemon Daemon: listens to requests from the Docker client manages Docker objects like containers and images can communicate with other Docker daemon Also a registry, where we store images Docker Hub is a public registry think Github It’s where we can find official Docker images for linux distributions, databases, and python (!).
  11. Show Image pull, push to a Registry
  12. https://github.com/docker/compose
  13. https://github.com/docker/compose
  14. https://github.com/docker/compose
  15. https://github.com/docker/compose
  16. https://github.com/docker/compose
  17. https://github.com/docker/compose