SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
Docker for DL
September 23, 2020
Andrea Panizza
https://github.com/AndreaPi/docker-for-deep-learning
Contents
September 23, 2020 2
$ docker why
$ docker what
$ docker how
$ portainer
$ docker --deep-learning
$ docker resources
$ (depend --on-docker)
September 23, 2020 3
docker why
- Choose an OS
- Install CUDA and CuDNN
- Install python (3.2? 3.5? 3.8?) &
libraries
- Install tensorflow & keras (or PyTorch)
- TF & CUDA versions not compatible
- TF & Keras versions not compatible
- Expose ports: possible conflicts
- Breaking updates
- Different OS/libraries in Dev/Prod
- Ok, but now it doesn’t scale
- HEEEEELLLLPP!!!!!!
- Install Docker
- Write a Dockerfile
- docker build
- docker run
-
September 23, 2020 4
docker what
virtual machines solve the dependency
issue…
…but they’re very resource-intensive
(scalability). We need a lighter framework
September 23, 2020 5
docker what
Docker containers are:
• Cheaper (less memory & CPU
overhead)
• Trendy
• Reproducible & portable
• Made to crash and be restarted
• Scaling and orchestrating is easy
• Develop code in your preferred
environment, run anywhere
September 23, 2020 6
docker what
Docker containers are not virtual machines:
• “VMs are like houses, each is a single unit w/ standalone plumbing and
wiring. Containers are like apartments; each one is a unit (process) in a host
(building), sharing the plumbing and wiring w/ one another as well as the rest
of the building” (Mike Coleman - Technology Evangelist, Docker)
September 23, 2020 7
docker vocabulary
image package defining a working environment (binary file)
container a running instance of an image (process)
Dockerfile text file containing commands to build an image
Docker Hub A web server/repository for sharing Docker images
Docker client sends CLI commands to Docker daemon through
Docker REST API
Docker daemon executes calls from Docker client
Docker native client/server architecture
makes it easy to design web services
September 23, 2020 8
docker architecture
September 23, 2020 9
docker how
• Define an image by writing a Dockerfile
• FROM: initialize a new build stage & set base
image. A valid Dockerfile must start with FROM.
• LABEL: add metadata to an image (key/value
pair). A typical key is maintainer
• COPY: copy files/folders from <src> and add to
container filesystem at path <dest>
• RUN: execute commands in a new layer on top
of the current image and commit results
• WORKDIR: set working directory for any
command which follows
• CMD: defaults for the container execution
September 23, 2020 10
docker how
To build the image, from the Dockerfile directory run
docker build [BUILD_OPTS] -t IMAGE:[TAG] (tip: always name & tag your images)
Docker pulls the base image from the Web (if it didn’t do it before) and starts building. After building, to run the
container, in any directory run
docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
(can be complicated…but see later!)
Each container is an instance of an image: you can run multiple (containers) instances based on the same image, as
long as each has a unique name.
Containers are stateless and immutable: once a container completes execution, all its content is lost, and any
other container started from the same image doesn’t inherit any state from the first one (reproducibility).
September 23, 2020 11
Mapping local folders
All content from a Docker container is lost, once it terminates execution. In order to export content from it,
we map a folder on the host filesystem, to a folder in the Docker container filesystem. Example:
docker run -v /home/andrea/docker_test:/test -it ubuntu /bin/bash
maps the folder docker_test on the host system to the folder /test in the Docker container1, starts
a container based on the ubuntu image in interactive mode and drops you in the bash shell.
1Warning: this kind of mapping is called a bind mount and it’s discouraged in modern Docker versions, in favor of volume mount. As a
Docker curmudgeon & a developer, I find bind mounting to be more useful for people like me who develop inside of a container, but
you’ve been warned.
September 23, 2020 12
portainer
Portainer is a web app (running inside
a…you guessed it, a container) which
allows you to manage your containers
(especially local ones), remove unused
containers, volumes, images, start and
stop containers, etc.
September 23, 2020 13
portainer
Being based on Docker, installing Portainer
requires just 2 shell commands:
docker volume create
portainer_data
docker run -d -p 9000:9000 --
name=portainer --
restart=always -v
/var/run/docker.sock:/var/run/
docker.sock -v
portainer_data:/data
portainer/portainer-ce
Then, point your browser to
localhost:9000 et voilà! You’re done.
September 23, 2020 14
portainer Restart/remove stopped containers
Delete unused images
Connect to containers
…and more!
September 23, 2020 15
portainer
• Portainer 2.0 CE (08/31/2020) supports Kubernetes, allowing users to manage
app deployments on Kubernetes clusters using the Portainer UX (“no more CLI,
no more YAML, no more Kubernetes manifests”)
• Faces the competition of Rancher and OpenShift!
September 23, 2020 16
docker --deep-learning
• Let’s build a simple image and make some practice with Docker
• We will create an image to run two models in Jupyter:
• a pre-trained ResNet-50 model (uses default Keras implementation)
• a pre-trained RetinaNet model (uses https://github.com/fizyr/keras-
retinanet/)
git clone https://github.com/AndreaPi/docker-for-deep-learning.git
September 23, 2020 17
docker resources
• How to Get Started with Docker (official intro atm)
• What is Docker in 5 minutes
• Learn Docker in 12 minutes
• Portainer - Lightweight Management UI for Docker
• the official Docker cheatsheet
• Some Docker notes
• https://docs.docker.com/develop/develop-images/dockerfile_best-
practices
• https://blog.docker.com/2019/07/intro-guide-to-dockerfile-best-
practices/
BACKUP
September 23, 2020 19
docker why
A true story
September 23, 2020 20
docker why
Q: isn’t this solved by
venv/pipenv/conda/
etc.?
A: Nope!
• venv & pipenv only deal with Python packages
dependencies. For anything else (e.g., Python version,
CUDA, libglib2.0-0, etc.) you’re pretty much f*ck*d.
Also, a virtual environment is not really self-contained:
some Python packages install stuff outside the virtual
env dir.
• conda can manage environments for other languages
other than Python, but it still doesn’t manage the other
dependencies
• None of these approaches guarantees seamless
transferability across different environments. You will
all have experiences of conda/venv crashing after
some admin change on your machines!
September 23, 2020 21
depend --on-docker
Depend On Docker is a framework
developed at former BHGE Digital
which helps building, shipping &
running applications with Docker.
September 23, 2020 22
Manage images/containers
docker images -aq List all images
docker ps -a List all containers: you need to remove
containers before you can remove images
docker rm <container-ID> remove container
docker rm $(docker ps -aq) remove all containers
docker rmi <image-ID> remove image
docker rmi $(docker images -aq) Remove all images
docker run --rm --it --name cntr myimage run container with name cntr, from image
myimage, in interactive (it) mode and
remove (rm) container after you exit:
great to avoid having many hanging
containers
September 23, 2020 23
A few extra tips on writing Dockerfiles
from https://blog.docker.com/2019/07/intro-guide-to-dockerfile-best-practices/
September 23, 2020 24
A few extra tips on writing Dockerfiles
from https://blog.docker.com/2019/07/intro-guide-to-dockerfile-best-practices/
• The Docker blog post lists even more best
practices which you may want to learn and
use!

Weitere ähnliche Inhalte

Was ist angesagt?

BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Dockerkanedafromparis
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'acorehard_by
 
Dockerfiles building docker images automatically v (workdir, env, add, and ...
Dockerfiles   building docker images automatically v (workdir, env, add, and ...Dockerfiles   building docker images automatically v (workdir, env, add, and ...
Dockerfiles building docker images automatically v (workdir, env, add, and ...ansonjonel
 
New Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentationNew Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentationIan Kluft
 
Docker containerization cookbook
Docker containerization cookbookDocker containerization cookbook
Docker containerization cookbookPascal Louis
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing dockerSascha Brinkmann
 
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
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerJustyna Ilczuk
 
[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101Naukri.com
 
How to Dockerize Web Application using Docker Compose
How to Dockerize Web Application using Docker ComposeHow to Dockerize Web Application using Docker Compose
How to Dockerize Web Application using Docker ComposeEvoke Technologies
 
Docker fundamentals
Docker fundamentalsDocker fundamentals
Docker fundamentalsAlper Unal
 
The challenge of application distribution - Introduction to Docker (2014 dec ...
The challenge of application distribution - Introduction to Docker (2014 dec ...The challenge of application distribution - Introduction to Docker (2014 dec ...
The challenge of application distribution - Introduction to Docker (2014 dec ...Sébastien Portebois
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshopRuncy Oommen
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdockerJaehwa Park
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned RightScale
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystempsconnolly
 
Présentation de Docker
Présentation de DockerPrésentation de Docker
Présentation de DockerProto204
 

Was ist angesagt? (20)

JOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to ProductionJOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to Production
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Docker
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 
Dockerfiles building docker images automatically v (workdir, env, add, and ...
Dockerfiles   building docker images automatically v (workdir, env, add, and ...Dockerfiles   building docker images automatically v (workdir, env, add, and ...
Dockerfiles building docker images automatically v (workdir, env, add, and ...
 
New Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentationNew Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentation
 
Docker containerization cookbook
Docker containerization cookbookDocker containerization cookbook
Docker containerization cookbook
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing docker
 
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
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
 
Docker
DockerDocker
Docker
 
How to Dockerize Web Application using Docker Compose
How to Dockerize Web Application using Docker ComposeHow to Dockerize Web Application using Docker Compose
How to Dockerize Web Application using Docker Compose
 
Docker fundamentals
Docker fundamentalsDocker fundamentals
Docker fundamentals
 
The challenge of application distribution - Introduction to Docker (2014 dec ...
The challenge of application distribution - Introduction to Docker (2014 dec ...The challenge of application distribution - Introduction to Docker (2014 dec ...
The challenge of application distribution - Introduction to Docker (2014 dec ...
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdocker
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
 
Présentation de Docker
Présentation de DockerPrésentation de Docker
Présentation de Docker
 

Ähnlich wie Docker for Deep Learning (Andrea Panizza)

Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Nicolas Poggi
 
Tips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podmanTips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podmanThierry Gayet
 
Docker for Fun and Profit
Docker for Fun and ProfitDocker for Fun and Profit
Docker for Fun and ProfitKel Cecil
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday developmentJustyna Ilczuk
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with DockerGeeta Vinnakota
 
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
 
Containerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and JavaContainerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and JavaJadson Santos
 
DevAssistant, Docker and You
DevAssistant, Docker and YouDevAssistant, Docker and You
DevAssistant, Docker and YouBalaBit
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsMicael Gallego
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
Containers without docker | DevNation Tech Talk
Containers without docker | DevNation Tech TalkContainers without docker | DevNation Tech Talk
Containers without docker | DevNation Tech TalkRed Hat Developers
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET DevelopersQuan Truong Anh
 

Ähnlich wie Docker for Deep Learning (Andrea Panizza) (20)

Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
Docker From Scratch
Docker From ScratchDocker From Scratch
Docker From Scratch
 
Tips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podmanTips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podman
 
Docker for Fun and Profit
Docker for Fun and ProfitDocker for Fun and Profit
Docker for Fun and Profit
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Docker
DockerDocker
Docker
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
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
 
Docker
DockerDocker
Docker
 
Containerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and JavaContainerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and Java
 
DevAssistant, Docker and You
DevAssistant, Docker and YouDevAssistant, Docker and You
DevAssistant, Docker and You
 
Docker
DockerDocker
Docker
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Docker @ Atlogys
Docker @ AtlogysDocker @ Atlogys
Docker @ Atlogys
 
Containers without docker | DevNation Tech Talk
Containers without docker | DevNation Tech TalkContainers without docker | DevNation Tech Talk
Containers without docker | DevNation Tech Talk
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 

Mehr von MeetupDataScienceRoma

Serve Davvero il Machine Learning nelle PMI? | Niccolò Annino
Serve Davvero il Machine Learning nelle PMI? | Niccolò AnninoServe Davvero il Machine Learning nelle PMI? | Niccolò Annino
Serve Davvero il Machine Learning nelle PMI? | Niccolò AnninoMeetupDataScienceRoma
 
Meta-learning through the lenses of Statistical Learning Theory (Carlo Cilibe...
Meta-learning through the lenses of Statistical Learning Theory (Carlo Cilibe...Meta-learning through the lenses of Statistical Learning Theory (Carlo Cilibe...
Meta-learning through the lenses of Statistical Learning Theory (Carlo Cilibe...MeetupDataScienceRoma
 
Claudio Gallicchio - Deep Reservoir Computing for Structured Data
Claudio Gallicchio - Deep Reservoir Computing for Structured DataClaudio Gallicchio - Deep Reservoir Computing for Structured Data
Claudio Gallicchio - Deep Reservoir Computing for Structured DataMeetupDataScienceRoma
 
Machine Learning for Epidemiological Models (Enrico Meloni)
Machine Learning for Epidemiological Models (Enrico Meloni)Machine Learning for Epidemiological Models (Enrico Meloni)
Machine Learning for Epidemiological Models (Enrico Meloni)MeetupDataScienceRoma
 
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)MeetupDataScienceRoma
 
Web Meetup #2: Modelli matematici per l'epidemiologia
Web Meetup #2: Modelli matematici per l'epidemiologiaWeb Meetup #2: Modelli matematici per l'epidemiologia
Web Meetup #2: Modelli matematici per l'epidemiologiaMeetupDataScienceRoma
 
Deep red - The environmental impact of deep learning (Paolo Caressa)
Deep red - The environmental impact of deep learning (Paolo Caressa)Deep red - The environmental impact of deep learning (Paolo Caressa)
Deep red - The environmental impact of deep learning (Paolo Caressa)MeetupDataScienceRoma
 
Paolo Galeone - Dissecting tf.function to discover auto graph strengths and s...
Paolo Galeone - Dissecting tf.function to discover auto graph strengths and s...Paolo Galeone - Dissecting tf.function to discover auto graph strengths and s...
Paolo Galeone - Dissecting tf.function to discover auto graph strengths and s...MeetupDataScienceRoma
 
Multimodal AI Approach to Provide Assistive Services (Francesco Puja)
Multimodal AI Approach to Provide Assistive Services (Francesco Puja)Multimodal AI Approach to Provide Assistive Services (Francesco Puja)
Multimodal AI Approach to Provide Assistive Services (Francesco Puja)MeetupDataScienceRoma
 
Introduzione - Meetup MLOps & Assistive AI
Introduzione - Meetup MLOps & Assistive AIIntroduzione - Meetup MLOps & Assistive AI
Introduzione - Meetup MLOps & Assistive AIMeetupDataScienceRoma
 
Zero, One, Many - Machine Learning in Produzione (Luca Palmieri)
Zero, One, Many - Machine Learning in Produzione (Luca Palmieri)Zero, One, Many - Machine Learning in Produzione (Luca Palmieri)
Zero, One, Many - Machine Learning in Produzione (Luca Palmieri)MeetupDataScienceRoma
 
Mario Incarnati - The power of data visualization
Mario Incarnati - The power of data visualizationMario Incarnati - The power of data visualization
Mario Incarnati - The power of data visualizationMeetupDataScienceRoma
 
OLIVAW: reaching superhuman strength at Othello
OLIVAW: reaching superhuman strength at OthelloOLIVAW: reaching superhuman strength at Othello
OLIVAW: reaching superhuman strength at OthelloMeetupDataScienceRoma
 
[Giovanni Galloro] How to use machine learning on Google Cloud Platform
[Giovanni Galloro] How to use machine learning on Google Cloud Platform[Giovanni Galloro] How to use machine learning on Google Cloud Platform
[Giovanni Galloro] How to use machine learning on Google Cloud PlatformMeetupDataScienceRoma
 
Bring your neural networks to the browser with TF.js - Simone Scardapane
Bring your neural networks to the browser with TF.js - Simone ScardapaneBring your neural networks to the browser with TF.js - Simone Scardapane
Bring your neural networks to the browser with TF.js - Simone ScardapaneMeetupDataScienceRoma
 
Meetup Gennaio 2019 - Slide introduttiva
Meetup Gennaio 2019 - Slide introduttivaMeetup Gennaio 2019 - Slide introduttiva
Meetup Gennaio 2019 - Slide introduttivaMeetupDataScienceRoma
 
Bruno Coletta - Data-Driven Creativity in Marketing and Advertising
Bruno Coletta - Data-Driven Creativity in Marketing and AdvertisingBruno Coletta - Data-Driven Creativity in Marketing and Advertising
Bruno Coletta - Data-Driven Creativity in Marketing and AdvertisingMeetupDataScienceRoma
 

Mehr von MeetupDataScienceRoma (20)

Serve Davvero il Machine Learning nelle PMI? | Niccolò Annino
Serve Davvero il Machine Learning nelle PMI? | Niccolò AnninoServe Davvero il Machine Learning nelle PMI? | Niccolò Annino
Serve Davvero il Machine Learning nelle PMI? | Niccolò Annino
 
Meta-learning through the lenses of Statistical Learning Theory (Carlo Cilibe...
Meta-learning through the lenses of Statistical Learning Theory (Carlo Cilibe...Meta-learning through the lenses of Statistical Learning Theory (Carlo Cilibe...
Meta-learning through the lenses of Statistical Learning Theory (Carlo Cilibe...
 
Claudio Gallicchio - Deep Reservoir Computing for Structured Data
Claudio Gallicchio - Deep Reservoir Computing for Structured DataClaudio Gallicchio - Deep Reservoir Computing for Structured Data
Claudio Gallicchio - Deep Reservoir Computing for Structured Data
 
Machine Learning for Epidemiological Models (Enrico Meloni)
Machine Learning for Epidemiological Models (Enrico Meloni)Machine Learning for Epidemiological Models (Enrico Meloni)
Machine Learning for Epidemiological Models (Enrico Meloni)
 
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
 
Web Meetup #2: Modelli matematici per l'epidemiologia
Web Meetup #2: Modelli matematici per l'epidemiologiaWeb Meetup #2: Modelli matematici per l'epidemiologia
Web Meetup #2: Modelli matematici per l'epidemiologia
 
Deep red - The environmental impact of deep learning (Paolo Caressa)
Deep red - The environmental impact of deep learning (Paolo Caressa)Deep red - The environmental impact of deep learning (Paolo Caressa)
Deep red - The environmental impact of deep learning (Paolo Caressa)
 
[Sponsored] C3.ai description
[Sponsored] C3.ai description[Sponsored] C3.ai description
[Sponsored] C3.ai description
 
Paolo Galeone - Dissecting tf.function to discover auto graph strengths and s...
Paolo Galeone - Dissecting tf.function to discover auto graph strengths and s...Paolo Galeone - Dissecting tf.function to discover auto graph strengths and s...
Paolo Galeone - Dissecting tf.function to discover auto graph strengths and s...
 
Multimodal AI Approach to Provide Assistive Services (Francesco Puja)
Multimodal AI Approach to Provide Assistive Services (Francesco Puja)Multimodal AI Approach to Provide Assistive Services (Francesco Puja)
Multimodal AI Approach to Provide Assistive Services (Francesco Puja)
 
Introduzione - Meetup MLOps & Assistive AI
Introduzione - Meetup MLOps & Assistive AIIntroduzione - Meetup MLOps & Assistive AI
Introduzione - Meetup MLOps & Assistive AI
 
Zero, One, Many - Machine Learning in Produzione (Luca Palmieri)
Zero, One, Many - Machine Learning in Produzione (Luca Palmieri)Zero, One, Many - Machine Learning in Produzione (Luca Palmieri)
Zero, One, Many - Machine Learning in Produzione (Luca Palmieri)
 
Mario Incarnati - The power of data visualization
Mario Incarnati - The power of data visualizationMario Incarnati - The power of data visualization
Mario Incarnati - The power of data visualization
 
Machine Learning in the AWS Cloud
Machine Learning in the AWS CloudMachine Learning in the AWS Cloud
Machine Learning in the AWS Cloud
 
OLIVAW: reaching superhuman strength at Othello
OLIVAW: reaching superhuman strength at OthelloOLIVAW: reaching superhuman strength at Othello
OLIVAW: reaching superhuman strength at Othello
 
[Giovanni Galloro] How to use machine learning on Google Cloud Platform
[Giovanni Galloro] How to use machine learning on Google Cloud Platform[Giovanni Galloro] How to use machine learning on Google Cloud Platform
[Giovanni Galloro] How to use machine learning on Google Cloud Platform
 
Bring your neural networks to the browser with TF.js - Simone Scardapane
Bring your neural networks to the browser with TF.js - Simone ScardapaneBring your neural networks to the browser with TF.js - Simone Scardapane
Bring your neural networks to the browser with TF.js - Simone Scardapane
 
Meetup Gennaio 2019 - Slide introduttiva
Meetup Gennaio 2019 - Slide introduttivaMeetup Gennaio 2019 - Slide introduttiva
Meetup Gennaio 2019 - Slide introduttiva
 
Elena Gagliardoni - Neural Chatbot
Elena Gagliardoni - Neural ChatbotElena Gagliardoni - Neural Chatbot
Elena Gagliardoni - Neural Chatbot
 
Bruno Coletta - Data-Driven Creativity in Marketing and Advertising
Bruno Coletta - Data-Driven Creativity in Marketing and AdvertisingBruno Coletta - Data-Driven Creativity in Marketing and Advertising
Bruno Coletta - Data-Driven Creativity in Marketing and Advertising
 

Kürzlich hochgeladen

[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Kürzlich hochgeladen (20)

[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

Docker for Deep Learning (Andrea Panizza)

  • 1. Docker for DL September 23, 2020 Andrea Panizza https://github.com/AndreaPi/docker-for-deep-learning
  • 2. Contents September 23, 2020 2 $ docker why $ docker what $ docker how $ portainer $ docker --deep-learning $ docker resources $ (depend --on-docker)
  • 3. September 23, 2020 3 docker why - Choose an OS - Install CUDA and CuDNN - Install python (3.2? 3.5? 3.8?) & libraries - Install tensorflow & keras (or PyTorch) - TF & CUDA versions not compatible - TF & Keras versions not compatible - Expose ports: possible conflicts - Breaking updates - Different OS/libraries in Dev/Prod - Ok, but now it doesn’t scale - HEEEEELLLLPP!!!!!! - Install Docker - Write a Dockerfile - docker build - docker run -
  • 4. September 23, 2020 4 docker what virtual machines solve the dependency issue… …but they’re very resource-intensive (scalability). We need a lighter framework
  • 5. September 23, 2020 5 docker what Docker containers are: • Cheaper (less memory & CPU overhead) • Trendy • Reproducible & portable • Made to crash and be restarted • Scaling and orchestrating is easy • Develop code in your preferred environment, run anywhere
  • 6. September 23, 2020 6 docker what Docker containers are not virtual machines: • “VMs are like houses, each is a single unit w/ standalone plumbing and wiring. Containers are like apartments; each one is a unit (process) in a host (building), sharing the plumbing and wiring w/ one another as well as the rest of the building” (Mike Coleman - Technology Evangelist, Docker)
  • 7. September 23, 2020 7 docker vocabulary image package defining a working environment (binary file) container a running instance of an image (process) Dockerfile text file containing commands to build an image Docker Hub A web server/repository for sharing Docker images Docker client sends CLI commands to Docker daemon through Docker REST API Docker daemon executes calls from Docker client Docker native client/server architecture makes it easy to design web services
  • 8. September 23, 2020 8 docker architecture
  • 9. September 23, 2020 9 docker how • Define an image by writing a Dockerfile • FROM: initialize a new build stage & set base image. A valid Dockerfile must start with FROM. • LABEL: add metadata to an image (key/value pair). A typical key is maintainer • COPY: copy files/folders from <src> and add to container filesystem at path <dest> • RUN: execute commands in a new layer on top of the current image and commit results • WORKDIR: set working directory for any command which follows • CMD: defaults for the container execution
  • 10. September 23, 2020 10 docker how To build the image, from the Dockerfile directory run docker build [BUILD_OPTS] -t IMAGE:[TAG] (tip: always name & tag your images) Docker pulls the base image from the Web (if it didn’t do it before) and starts building. After building, to run the container, in any directory run docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...] (can be complicated…but see later!) Each container is an instance of an image: you can run multiple (containers) instances based on the same image, as long as each has a unique name. Containers are stateless and immutable: once a container completes execution, all its content is lost, and any other container started from the same image doesn’t inherit any state from the first one (reproducibility).
  • 11. September 23, 2020 11 Mapping local folders All content from a Docker container is lost, once it terminates execution. In order to export content from it, we map a folder on the host filesystem, to a folder in the Docker container filesystem. Example: docker run -v /home/andrea/docker_test:/test -it ubuntu /bin/bash maps the folder docker_test on the host system to the folder /test in the Docker container1, starts a container based on the ubuntu image in interactive mode and drops you in the bash shell. 1Warning: this kind of mapping is called a bind mount and it’s discouraged in modern Docker versions, in favor of volume mount. As a Docker curmudgeon & a developer, I find bind mounting to be more useful for people like me who develop inside of a container, but you’ve been warned.
  • 12. September 23, 2020 12 portainer Portainer is a web app (running inside a…you guessed it, a container) which allows you to manage your containers (especially local ones), remove unused containers, volumes, images, start and stop containers, etc.
  • 13. September 23, 2020 13 portainer Being based on Docker, installing Portainer requires just 2 shell commands: docker volume create portainer_data docker run -d -p 9000:9000 -- name=portainer -- restart=always -v /var/run/docker.sock:/var/run/ docker.sock -v portainer_data:/data portainer/portainer-ce Then, point your browser to localhost:9000 et voilà! You’re done.
  • 14. September 23, 2020 14 portainer Restart/remove stopped containers Delete unused images Connect to containers …and more!
  • 15. September 23, 2020 15 portainer • Portainer 2.0 CE (08/31/2020) supports Kubernetes, allowing users to manage app deployments on Kubernetes clusters using the Portainer UX (“no more CLI, no more YAML, no more Kubernetes manifests”) • Faces the competition of Rancher and OpenShift!
  • 16. September 23, 2020 16 docker --deep-learning • Let’s build a simple image and make some practice with Docker • We will create an image to run two models in Jupyter: • a pre-trained ResNet-50 model (uses default Keras implementation) • a pre-trained RetinaNet model (uses https://github.com/fizyr/keras- retinanet/) git clone https://github.com/AndreaPi/docker-for-deep-learning.git
  • 17. September 23, 2020 17 docker resources • How to Get Started with Docker (official intro atm) • What is Docker in 5 minutes • Learn Docker in 12 minutes • Portainer - Lightweight Management UI for Docker • the official Docker cheatsheet • Some Docker notes • https://docs.docker.com/develop/develop-images/dockerfile_best- practices • https://blog.docker.com/2019/07/intro-guide-to-dockerfile-best- practices/
  • 19. September 23, 2020 19 docker why A true story
  • 20. September 23, 2020 20 docker why Q: isn’t this solved by venv/pipenv/conda/ etc.? A: Nope! • venv & pipenv only deal with Python packages dependencies. For anything else (e.g., Python version, CUDA, libglib2.0-0, etc.) you’re pretty much f*ck*d. Also, a virtual environment is not really self-contained: some Python packages install stuff outside the virtual env dir. • conda can manage environments for other languages other than Python, but it still doesn’t manage the other dependencies • None of these approaches guarantees seamless transferability across different environments. You will all have experiences of conda/venv crashing after some admin change on your machines!
  • 21. September 23, 2020 21 depend --on-docker Depend On Docker is a framework developed at former BHGE Digital which helps building, shipping & running applications with Docker.
  • 22. September 23, 2020 22 Manage images/containers docker images -aq List all images docker ps -a List all containers: you need to remove containers before you can remove images docker rm <container-ID> remove container docker rm $(docker ps -aq) remove all containers docker rmi <image-ID> remove image docker rmi $(docker images -aq) Remove all images docker run --rm --it --name cntr myimage run container with name cntr, from image myimage, in interactive (it) mode and remove (rm) container after you exit: great to avoid having many hanging containers
  • 23. September 23, 2020 23 A few extra tips on writing Dockerfiles from https://blog.docker.com/2019/07/intro-guide-to-dockerfile-best-practices/
  • 24. September 23, 2020 24 A few extra tips on writing Dockerfiles from https://blog.docker.com/2019/07/intro-guide-to-dockerfile-best-practices/ • The Docker blog post lists even more best practices which you may want to learn and use!