SlideShare a Scribd company logo
1 of 33
6 Years of Docker:
The Good, the Bad and
Python Packaging
Sebastian Neubauer
@sebineubauer
PyCon.DE 2019
Introduction
What is docker and why?
@sebineubauer
Docker is not a virtual machine
5
CPU
Memory
Disc
Hypervisor
@sebineubauer
Docker is not a virtual machine
6
cgroups
namespaces
chroot
@sebineubauer
Docker is not a virtual machine
7
@sebineubauer
Docker is not a virtual machine (on linux!!!)
8
@sebineubauer
Docker *is* a virtual machine (on Mac & Windows!!!)
@sebineubauer
Docker *is* a virtual machine (on Mac & Windows!!!)
10
 Docker on Mac is starting a special
VM which runs docker inside
 Bottleneck is the mounted
filesystem inside the docker VM
@sebineubauer
Docker on Mac
11
 Only mount into the VM what is needed (configurable in Docker for Mac)
 Use as little volumes as possible, only mount what is needed in the containers
 Use the docker mount flags for volumes:
- „delegated“: lowest consistency guarantees, but „fastest“, host lags behind
- „cached“: stronger guarantees as „delegated“, but not as fast, container lags behind
 Use a different approach than mounting:
- docker-sync
- Rsync
@sebineubauer
Virtual environment inside docker?
13
 Better use virtual environments:
- Even in docker there is a full linux, the system python is for the OS:
- Python version is coupled to the OS
- Easy to break things, e.g. by installing a new system python version
- The system python installation (paths, names of binaries,..) might differ between linux distributions
- Isolate your application dependencies from the global dependencies:
- Easy to mess up the installed system python packages
- Easy to end up in strange bugs mixing system and application dependencies
 Conda is an interesting alternative:
- A package manager + distribution + environment manager
- Keep track of non-python dependencies (e.g. underlying c-libraries used by numpy, scipy, etc...)
- Admittedly, it feels even more crazy, but it JustWorks™ :)
@sebineubauer
Vitualenv + Docker
14
 Do not put the virtual environment inside a mounted volume!
- Put it e.g. in /tmp/venv
- It will speed-up a lot (cargo cult)
- Drawback might be, with every `docker run` you need to recreate the virtualenv
@sebineubauer
Vitualenv + Docker
15
 Mount the pip cache into the container
- This way, you don‘t need to download all packages again and again
- Slowness of the mount does not hurt that much, as it is only accessed once for the install
- A bit tricky to get it working:
- To get it working you need to run once „chown“ to the correct UID and GID of the docker user (thanks @fjetter)
@sebineubauer
Vitualenv + Docker
16
 Create the virtualenv already in the docker build
- This way it is baked inside the image and does not need to re-created again and again
- Drawback is, that you need to recreate the image for every new dependency
- Dependencies will easily out-date if not recreated regularily
 ProTip:
- https://stackoverflow.com/questions/25305788/how-to-avoid-reinstalling-packages-when-building-docker-image-for-python-project
@sebineubauer
Docker vs. Docker-Compose
@sebineubauer
Docker vs. Docker-Compose
 Docker-compose can make sense
even for single containers
 The simple and declarative syntax
of the docker-compose.yaml
makes it easy to add additional
configurations on top of „raw
images“:
- Volumes
- Network
- Environment variables
 It‘s „command line options in git“
Problem: pip install --editable
@sebineubauer
Problem: pip install --editable
@sebineubauer
Problem: pip install --editable
 We need the editable flag to directly execute our latest code changes without
reinstalling
 ‘pip --editable‘ always creates a package.egg_info directory in the package root
 We want to mount our source folder in the docker container, because our IDE
runs on the host
 Problem:
- Either the egg_info directory vanishes by mounting the host folder (broken setup!)
- Or we need to delay the installation after the image is built and the volume is mounte:
- Prolongs startup time
- Need to build „tricky“ automation or do it manually
- In the host folder suddenly a “egg_info“ folder pops up (only a aestethic problem)
- Or we use legacy `python setup.py develop` and set PYTHONPATH manually
@sebineubauer
Problem: pip install --editable
https://thekev.in/blog/2016-11-18-python-in-docker/index.html
Problem: Python cache files
@sebineubauer
Problem: Python cache files
@sebineubauer
Problem: Python cache files
 Python bytecode files (*.pyc) are stored next to the source files
 But we mount the source files from the host
 We might execute the code also on the host, or mount the same source folder in
other docker containers, with different OS, or python versions
@sebineubauer
Problem: Python cache files
https://stackoverflow.com/questions/28991015/python3-project-remove-pycache-folders-and-pyc-files
@sebineubauer
How to improve the situation?
 Awareness: No, it‘s not you! There are some really annoying dark corners.
 Contribute: Yes, the threads are long and disappointing...But maybe we have to
jump in!
 Share: Talk about what you know, write blog posts, etc... It helps a lot!
 Zen: There should be one obvious way to do it!
 Code: Even if the problems remain, we might be able to relieve the pain a bit
https://github.com/sebastianneubauer/dockerize-python-scaffold
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData Berlin 2019

More Related Content

What's hot

Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and AgentRanjit Avasarala
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013Tomas Doran
 
Package Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPackage Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPuppet
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 
Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Puppet
 
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet
 
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreChef Software, Inc.
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Bill Maxwell
 
Docker workshop
Docker workshopDocker workshop
Docker workshopEvans Ye
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-OverviewCrifkin
 
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015Publicis Sapient Engineering
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentCarlos Perez
 
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05dotCloud
 
First steps to docker
First steps to dockerFirst steps to docker
First steps to dockerGuilhem Marty
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflowTomas Doran
 

What's hot (20)

Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 
Vagrant + Docker
Vagrant + DockerVagrant + Docker
Vagrant + Docker
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
 
Package Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPackage Management on Windows with Chocolatey
Package Management on Windows with Chocolatey
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014
 
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
 
Vagrant to-aws-flow
Vagrant to-aws-flowVagrant to-aws-flow
Vagrant to-aws-flow
 
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-Overview
 
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
 
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
 
First steps to docker
First steps to dockerFirst steps to docker
First steps to docker
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
 
DevOps: Docker Workshop
DevOps: Docker WorkshopDevOps: Docker Workshop
DevOps: Docker Workshop
 

Similar to 6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData Berlin 2019

Docker in Action
Docker in ActionDocker in Action
Docker in ActionAlper Kanat
 
Ansible Workshop for Pythonistas
Ansible Workshop for PythonistasAnsible Workshop for Pythonistas
Ansible Workshop for PythonistasMihai Criveti
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.comMathieu Buffenoir
 
DockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDocker, Inc.
 
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
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortalsHenryk Konsek
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker, Inc.
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutesLarry Cai
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationErica Windisch
 
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeDevops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeIsrael Shirk
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker皓鈞 張
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationGiacomo Vacca
 
Novices guide to docker
Novices guide to dockerNovices guide to docker
Novices guide to dockerAlec Clews
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 

Similar to 6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData Berlin 2019 (20)

Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
What is Docker
What is DockerWhat is Docker
What is Docker
 
Ansible Workshop for Pythonistas
Ansible Workshop for PythonistasAnsible Workshop for Pythonistas
Ansible Workshop for Pythonistas
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com
 
DockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with Docker
 
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
 
Ansible container
Ansible containerAnsible container
Ansible container
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
 
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeDevops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
Novices guide to docker
Novices guide to dockerNovices guide to docker
Novices guide to docker
 
Docker 101
Docker 101 Docker 101
Docker 101
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 

Recently uploaded

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 

Recently uploaded (20)

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 

6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData Berlin 2019

  • 1. 6 Years of Docker: The Good, the Bad and Python Packaging Sebastian Neubauer @sebineubauer PyCon.DE 2019
  • 2.
  • 3.
  • 5. @sebineubauer Docker is not a virtual machine 5 CPU Memory Disc Hypervisor
  • 6. @sebineubauer Docker is not a virtual machine 6 cgroups namespaces chroot
  • 7. @sebineubauer Docker is not a virtual machine 7
  • 8. @sebineubauer Docker is not a virtual machine (on linux!!!) 8
  • 9. @sebineubauer Docker *is* a virtual machine (on Mac & Windows!!!)
  • 10. @sebineubauer Docker *is* a virtual machine (on Mac & Windows!!!) 10  Docker on Mac is starting a special VM which runs docker inside  Bottleneck is the mounted filesystem inside the docker VM
  • 11. @sebineubauer Docker on Mac 11  Only mount into the VM what is needed (configurable in Docker for Mac)  Use as little volumes as possible, only mount what is needed in the containers  Use the docker mount flags for volumes: - „delegated“: lowest consistency guarantees, but „fastest“, host lags behind - „cached“: stronger guarantees as „delegated“, but not as fast, container lags behind  Use a different approach than mounting: - docker-sync - Rsync
  • 12.
  • 13. @sebineubauer Virtual environment inside docker? 13  Better use virtual environments: - Even in docker there is a full linux, the system python is for the OS: - Python version is coupled to the OS - Easy to break things, e.g. by installing a new system python version - The system python installation (paths, names of binaries,..) might differ between linux distributions - Isolate your application dependencies from the global dependencies: - Easy to mess up the installed system python packages - Easy to end up in strange bugs mixing system and application dependencies  Conda is an interesting alternative: - A package manager + distribution + environment manager - Keep track of non-python dependencies (e.g. underlying c-libraries used by numpy, scipy, etc...) - Admittedly, it feels even more crazy, but it JustWorks™ :)
  • 14. @sebineubauer Vitualenv + Docker 14  Do not put the virtual environment inside a mounted volume! - Put it e.g. in /tmp/venv - It will speed-up a lot (cargo cult) - Drawback might be, with every `docker run` you need to recreate the virtualenv
  • 15. @sebineubauer Vitualenv + Docker 15  Mount the pip cache into the container - This way, you don‘t need to download all packages again and again - Slowness of the mount does not hurt that much, as it is only accessed once for the install - A bit tricky to get it working: - To get it working you need to run once „chown“ to the correct UID and GID of the docker user (thanks @fjetter)
  • 16. @sebineubauer Vitualenv + Docker 16  Create the virtualenv already in the docker build - This way it is baked inside the image and does not need to re-created again and again - Drawback is, that you need to recreate the image for every new dependency - Dependencies will easily out-date if not recreated regularily  ProTip: - https://stackoverflow.com/questions/25305788/how-to-avoid-reinstalling-packages-when-building-docker-image-for-python-project
  • 17.
  • 19. @sebineubauer Docker vs. Docker-Compose  Docker-compose can make sense even for single containers  The simple and declarative syntax of the docker-compose.yaml makes it easy to add additional configurations on top of „raw images“: - Volumes - Network - Environment variables  It‘s „command line options in git“
  • 20.
  • 21. Problem: pip install --editable
  • 23. @sebineubauer Problem: pip install --editable  We need the editable flag to directly execute our latest code changes without reinstalling  ‘pip --editable‘ always creates a package.egg_info directory in the package root  We want to mount our source folder in the docker container, because our IDE runs on the host  Problem: - Either the egg_info directory vanishes by mounting the host folder (broken setup!) - Or we need to delay the installation after the image is built and the volume is mounte: - Prolongs startup time - Need to build „tricky“ automation or do it manually - In the host folder suddenly a “egg_info“ folder pops up (only a aestethic problem) - Or we use legacy `python setup.py develop` and set PYTHONPATH manually
  • 24. @sebineubauer Problem: pip install --editable https://thekev.in/blog/2016-11-18-python-in-docker/index.html
  • 27. @sebineubauer Problem: Python cache files  Python bytecode files (*.pyc) are stored next to the source files  But we mount the source files from the host  We might execute the code also on the host, or mount the same source folder in other docker containers, with different OS, or python versions
  • 28. @sebineubauer Problem: Python cache files https://stackoverflow.com/questions/28991015/python3-project-remove-pycache-folders-and-pyc-files
  • 29.
  • 30.
  • 31.
  • 32. @sebineubauer How to improve the situation?  Awareness: No, it‘s not you! There are some really annoying dark corners.  Contribute: Yes, the threads are long and disappointing...But maybe we have to jump in!  Share: Talk about what you know, write blog posts, etc... It helps a lot!  Zen: There should be one obvious way to do it!  Code: Even if the problems remain, we might be able to relieve the pain a bit https://github.com/sebastianneubauer/dockerize-python-scaffold

Editor's Notes

  1. Solomon Hykes Pycon US in Santa Clara in 2013 (first pydata berlin was 2014) Lightning talk 5 minutes (who attended lightning talk yesterday?) Remarkable live demo: linux containers, but easy
  2. most famous hello world typo so far should go to a museum
  3. one of the first decisions to make
  4. Fun fact: docker compose written entirely in python
  5. A serious warning for the end: Don‘t build a snowflake!!!
  6. Why is all this so important: often the first contact to a project is a easy to access local dev environment using docker