SlideShare a Scribd company logo
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!

More Related Content

What's hot

JOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to ProductionJOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to Production
Jordan Open Source Association
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
CodeOps Technologies LLP
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Docker
kanedafromparis
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
corehard_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 presentation
Ian Kluft
 
Docker containerization cookbook
Docker containerization cookbookDocker containerization cookbook
Docker containerization cookbook
Pascal Louis
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing docker
Sascha 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 example
Fabio Mora
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
Justyna Ilczuk
 
[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
Naukri.com
 
Docker
DockerDocker
Docker
Chen Chun
 
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
Evoke Technologies
 
Docker fundamentals
Docker fundamentalsDocker fundamentals
Docker fundamentals
Alper 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 workshop
Runcy Oommen
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdocker
Jaehwa 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 Ecosystem
psconnolly
 
Présentation de Docker
Présentation de DockerPrésentation de Docker
Présentation de Docker
Proto204
 

What's hot (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
 

Similar to Docker for Deep Learning (Andrea Panizza)

Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
Nicolas Poggi
 
Docker From Scratch
Docker From ScratchDocker From Scratch
Docker From Scratch
Giacomo Vacca
 
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
Thierry Gayet
 
Docker for Fun and Profit
Docker for Fun and ProfitDocker for Fun and Profit
Docker for Fun and Profit
Kel Cecil
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
Justyna Ilczuk
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
Carlo Bonamico
 
Docker
DockerDocker
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
Patrick Chanezon
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
Geeta 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 Container
Guido Schmutz
 
Docker
DockerDocker
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
Jadson Santos
 
DevAssistant, Docker and You
DevAssistant, Docker and YouDevAssistant, Docker and You
DevAssistant, Docker and You
BalaBit
 
Docker
DockerDocker
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
Araf Karsh Hamid
 
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
Micael Gallego
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
Roman Rodomansky
 
Docker @ Atlogys
Docker @ AtlogysDocker @ Atlogys
Containers without docker | DevNation Tech Talk
Containers without docker | DevNation Tech TalkContainers without docker | DevNation Tech Talk
Containers without docker | DevNation Tech Talk
Red Hat Developers
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
Quan Truong Anh
 

Similar to 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
 

More from 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ò Annino
MeetupDataScienceRoma
 
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 Data
MeetupDataScienceRoma
 
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'epidemiologia
MeetupDataScienceRoma
 
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
 
[Sponsored] C3.ai description
[Sponsored] C3.ai description[Sponsored] C3.ai description
[Sponsored] C3.ai description
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 AI
MeetupDataScienceRoma
 
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 visualization
MeetupDataScienceRoma
 
Machine Learning in the AWS Cloud
Machine Learning in the AWS CloudMachine Learning in the AWS Cloud
Machine Learning in the AWS Cloud
MeetupDataScienceRoma
 
OLIVAW: reaching superhuman strength at Othello
OLIVAW: reaching superhuman strength at OthelloOLIVAW: reaching superhuman strength at Othello
OLIVAW: reaching superhuman strength at Othello
MeetupDataScienceRoma
 
[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
MeetupDataScienceRoma
 
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
MeetupDataScienceRoma
 
Meetup Gennaio 2019 - Slide introduttiva
Meetup Gennaio 2019 - Slide introduttivaMeetup Gennaio 2019 - Slide introduttiva
Meetup Gennaio 2019 - Slide introduttiva
MeetupDataScienceRoma
 
Elena Gagliardoni - Neural Chatbot
Elena Gagliardoni - Neural ChatbotElena Gagliardoni - Neural Chatbot
Elena Gagliardoni - Neural Chatbot
MeetupDataScienceRoma
 
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
MeetupDataScienceRoma
 

More from 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
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 

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!