How to containerize Python applications with Docker
summary
Step-by-step show of containerizing a simple Python script and a FastAPI web app using python:3.9 base image, building Dockerfiles that add source, run `pip install` and set CMD, and a second Dockerfile that uses a working dir, `pip freeze` -> requirements.txt and pip install --no-cache-dir. Demonstrates interactive input with `docker run -it`, exposes the server with --host 0.0.0.0 and maps ports, then runs detached with docker run -p 80:80 -d and successfully execs into the container to inspect files.
AI-written summary · about
chapters (13)
- 0:00Start
- 0:56About Me
- 1:36About Docker
- 2:34Install the Official Docker Extension
- 4:27Create a Docker File
- 4:48Docker File
- 5:26Creating the Image
- 7:11Install the Third Party Libraries
- 8:27The Docker Build Command
- 12:03Create a Simple Web App
- 12:32Virtual Environment
- 19:05Use a Docker Ignore File
- 24:24A Terminal inside the Container
related talks
30mHow to Create a Great Local Python Development Environment with Docker
54mSnaking Python Into Kubernetes
02h 28mWorkshop: Learn How to Dockerize Your Python Application
34mModern development environments for Pythonistas
27mDocker + Python
23mCleaning Up Your Python Environment Superfund Site
32mMigrating to Python 3 using Docker for your CI/CD pipeline (even if you can't use it in production)
45mRunning Django on Docker: a workflow and code
