🌐
Docker Hub
hub.docker.com › _ › python
python - Official Image | Docker Hub
This tag is based off of buildpack-deps⁠. buildpack-deps is designed for the average user of Docker who has many images on their system. It, by design, has a large number of extremely common Debian packages. This reduces the number of packages that images that derive from it need to install, thus reducing the overall size of all images on your system. This image does not contain the common Debian packages contained in the default tag and only contains the minimal Debian packages needed to run python.
🌐
Docker
docker-py.readthedocs.io
Docker SDK for Python — Docker SDK for Python 7.2.0 documentation
A Python library for the Docker Engine API. It lets you do anything the docker command does, but from within Python apps – run containers, manage containers, manage Swarms, etc.
Discussions

Why we dropped Docker for Python environments
We find that clusters depending on docker images often take 5+ minutes to launch. Ouch. I've never encountered this problem, with the possible exception of a few extremely heavy model containers (as in they had to pull in 4gb of model weight files). The numbers here are also pretty ridiculous. 2.5 minutes to build 2 minutes to push 2.5 minutes to pull I have to ask- how big are these images? When pushing to ECR it normally only takes me a few seconds to push the changed layers up. Is it possible your images were poorly optmized so you were rebuilding, compressing, and pushing layers that could have been skipped with some organization? I'm also curious about how the other changes you made might be causing the issues here. You're starting with a t3.medium, which is known to both throttle CPU when credits are low and that it throttles networking due to the hidden network credits- it's basically the worst time of machine to use for building docker images. You explicitly mention moving to a large machine for builds- Use a big machine and ask conda/pip to store packages to a RAM disk That is going to increase your networking speed, lower the time spent compressing, and otherwise speed up every aspect of the pipeline even if you didn't make any other changes. What machine family did you move to? More on reddit.com
🌐 r/Python
108
284
April 12, 2023
The best way to use docker with Python for development environments
I will write the main points how we are do container-based environments with docker-compose. for each and separate site (both frontend and backend code) a separate repo with 1 docker-compose.yml which defines "nginx", "python", "redis", "node", "postgresql" services as separate containers (plus any other we need) and the codebase is mounted to these containers, we don't build new containers for every deploy. Now, since we use multiple sites on 1 machine and we'd like to run them in parallel at ports 80, 443, we have a separate repo with 1 docker-compose.yml that starts a Traefik reverse proxy witha "traefik" docker network. and each repo's docker-compose is set to connect to that "traefik" docker network, each site has a URL set with Traefik labels. For example we set for a repo that a "python" service URL is https://mysite1.com , then if you open the browser at that URL, Traefik automatically routes to that "python" service. Traefik also does built-in automatic Let's Encrypt SSL certificate generation. More info about that: https://doc.traefik.io/traefik/providers/docker/ for vscode there is a plugin called Dev Containers ( https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers ) these allow to attach to any running container in a new vscode window, and we can run debugger and code autocompletion there, since if you attach to a python container, you have a python environment installed. (Plus we use these also for python: https://marketplace.visualstudio.com/items?itemName=ms-python.python https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance , so we use DebugPy to debug python scripts inside that, we start the debugger at inside the container, and we can attach to it fine) for nodejs the same solution could be used. And I think you don't even need to attach to a node JS container as you can run on your computer commands that should execute inside a container like this: docker compose exec , for example: docker compose exec node npm run dev we start the dev environment with docker compose up -d (first for Traefik repo, and after Traefik runs, then again docker compose up -d for each and every site we need to work on), and stop it with docker compose down. Pretty straightforward and standard. note that docker compose down removes containers and volumes, so if you use a persistent database, then you need to define a volume for the db files, so the db will not be lost after docker compose down. If it is a small/medium site that doesn't need high availability and autoscaling, this Traefik with docker-compose solution also works fine for production. The docker-compose alternatives for creating easier dev environments are Lando or DDEV but there's less documentation about those for Python projects, and they are not suitable for production but they are easier to use than docker compose. For example, they do this Traefik proxy setup by themselves, you can create scriptable commands, so you don't need to write the whole command every time like "docker compose exec python python manage.py runserver 0.0.0.0:80" but with a customly defined "lando runserver" as a simple example. More on reddit.com
🌐 r/docker
6
3
March 5, 2024
is learning docker worth it for hobby Python development?
Yes! You should learn Docker. There's a reason containers are rapidly taking over the software world. It's a brilliant technology. It could even make you a better candidate for jobs, especially for companies that utilize modern DevOps practices. I still don't really understand what a development workflow in docker and vscode would look like as a single hooby dev. I'll try to layout a few steps you can achieve in order to achieve a working containerized Python app: Write a Dockerfile that turns your Python app into an image. You can find many guides for this online (including for FastAPI), but basically you base your image on Python from Docker Hub , import the "requirements.txt" file, pip install it, import the rest of the source code files and then run the application. You can also include uvicorn in the requirements, and run that instead. Build the image based on the Dockerfile from step 1. Write a docker-compose.yml file that runs three services: the image you built in step 2, a database, and a reverse proxy (such as nginx). This is called a three-tier application. If you have any questions, please PM me. I would love to help you with this. More on reddit.com
🌐 r/learnpython
40
138
September 20, 2022
Any docker image with python and pip preinstalled?
Is there any docker image available which comes with pre installed python and pip. I am quite new to docker. More on forums.docker.com
🌐 forums.docker.com
6
0
December 28, 2017
🌐
JFrog
jfrog.com › home › python base image
What is a Python Base Image? | JFrog
July 3, 2026 - A Python base image serves as the foundational layer for Docker images designed for Python applications, and provides a pre-configured environment with the Python interpreter and essential tools.
🌐
Docker
hub.docker.com › search
Explore Docker's Container Image Repository | Docker Hub
ActiveState's customizable, low-to-no vulnerability container image for python. ... Deploy, scale, and secure critical infrastructure with Cleanstart's hardened container images. ... A Docker images of Python environment .
🌐
GitHub
github.com › docker-library › python
GitHub - docker-library/python: Docker Official Image packaging for Python · GitHub
This is the Git repo of the Docker "Official Image" for python (not to be confused with any official python image provided by python upstream).
🌐
Reddit
reddit.com › r/python › why we dropped docker for python environments
r/Python on Reddit: Why we dropped Docker for Python environments
April 12, 2023 -

TL;DR Docker is a great tool for managing software environments, but we found that it’s just too slow, especially for exploratory data workflows where users change their Python environments frequently.

We find that clusters depending on docker images often take 5+ minutes to launch. Ouch. In Coiled you can use a new system for creating software environments on the fly using only mamba instead. We’re seeing start times 3x faster, or about 1–2 minutes.

This article goes into the challenges we (Coiled) faced, the solution we chose, and the performance impacts of that choice.

https://medium.com/coiled-hq/just-in-time-python-environments-ade108ec67b6

Top answer
1 of 14
231
We find that clusters depending on docker images often take 5+ minutes to launch. Ouch. I've never encountered this problem, with the possible exception of a few extremely heavy model containers (as in they had to pull in 4gb of model weight files). The numbers here are also pretty ridiculous. 2.5 minutes to build 2 minutes to push 2.5 minutes to pull I have to ask- how big are these images? When pushing to ECR it normally only takes me a few seconds to push the changed layers up. Is it possible your images were poorly optmized so you were rebuilding, compressing, and pushing layers that could have been skipped with some organization? I'm also curious about how the other changes you made might be causing the issues here. You're starting with a t3.medium, which is known to both throttle CPU when credits are low and that it throttles networking due to the hidden network credits- it's basically the worst time of machine to use for building docker images. You explicitly mention moving to a large machine for builds- Use a big machine and ask conda/pip to store packages to a RAM disk That is going to increase your networking speed, lower the time spent compressing, and otherwise speed up every aspect of the pipeline even if you didn't make any other changes. What machine family did you move to?
2 of 14
52
Docker for pure python always looks like an overkill to me-- in recent years, with the advent of wheels, you can install most (majority?) of libraries ina venv using just pip install-- no need to mess about with C compilers (and yes this includes data science libraries). I would always use a pure venv, and only move to docker if you have external dependencies (non-python)
🌐
Medium
medium.com › @mjrod › deploying-a-python-application-to-docker-4478787c2add
Creating a Custom Python Application Image and Deploying to Docker | by Michael Rodgers | Medium
May 19, 2022 - Container deployed from custom image on local computer · docker login --username=mjrod run this if required to connect CLI to Docker Hub account · docker tag hello-py mjrod/hello-py tag the image with your Docker Hub username: <username>/<image-name> docker push mjrod/hello-py to push a new repository to Docker Hub to store the image ... Navigate to http://<remote-docker-ip>:5000 to see the Python application running in the remote container
Find elsewhere
🌐
Docker
docs.docker.com › guides › python language-specific guide
Python language-specific guide | Docker Docs
July 21, 2026 - Create the following files in a new python-docker-example directory. To create all the files at once, switch to the Scaffold script tab in the file browser and copy the shell command. ... # A minimal FastAPI application. # The root endpoint (GET /) returns a JSON "Hello World" response. # See https://fastapi.tiangolo.com/ for the framework reference. from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"}
🌐
GitHub
github.com › docker › docker-py
GitHub - docker/docker-py: A Python library for the Docker Engine API · GitHub
A Python library for the Docker Engine API. It lets you do anything the docker command does, but from within Python apps – run containers, manage containers, manage Swarms, etc.
🌐
Reddit
reddit.com › r/docker › the best way to use docker with python for development environments
r/docker on Reddit: The best way to use docker with Python for development environments
March 5, 2024 -

Hello everyone,
I'm currently working on a project that involves multiple services: Django for the backend, PostgreSQL, and a front-end using Next.js. Maybe Redis and Celery in the future. Each of these services has its own GitHub repository and I've unified them using Git submodules.
Deployment using Dockerw (with Nginx and Gunicorn) works well. However, the problem is when it comes to setting up Docker for our development environment.
We're a team of three developers, and "ideally", I want each developer to be able to clone the repository and run docker-compose up to have all the services up and running. Also, I'd like the frontend developer to have the frontend directory binded for instant updates and the same for the backend developer and others.
The problem is with VsCode, especially with managing node_modules and Python packages within the Docker containers. VSCode doesn't recognize which packages are installed in the running containers (which is normal because it searches for the node_module in the local directory and it uses the host system Python interpreter).
For Next.js and React, I use a workaround by installing the packages in the container and then copying them to the local working directory using Dockerfile and Docker-compose configurations. However, with Python, I can't implement the same approach.
Thank you!

Top answer
1 of 3
2
I will write the main points how we are do container-based environments with docker-compose. for each and separate site (both frontend and backend code) a separate repo with 1 docker-compose.yml which defines "nginx", "python", "redis", "node", "postgresql" services as separate containers (plus any other we need) and the codebase is mounted to these containers, we don't build new containers for every deploy. Now, since we use multiple sites on 1 machine and we'd like to run them in parallel at ports 80, 443, we have a separate repo with 1 docker-compose.yml that starts a Traefik reverse proxy witha "traefik" docker network. and each repo's docker-compose is set to connect to that "traefik" docker network, each site has a URL set with Traefik labels. For example we set for a repo that a "python" service URL is https://mysite1.com , then if you open the browser at that URL, Traefik automatically routes to that "python" service. Traefik also does built-in automatic Let's Encrypt SSL certificate generation. More info about that: https://doc.traefik.io/traefik/providers/docker/ for vscode there is a plugin called Dev Containers ( https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers ) these allow to attach to any running container in a new vscode window, and we can run debugger and code autocompletion there, since if you attach to a python container, you have a python environment installed. (Plus we use these also for python: https://marketplace.visualstudio.com/items?itemName=ms-python.python https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance , so we use DebugPy to debug python scripts inside that, we start the debugger at inside the container, and we can attach to it fine) for nodejs the same solution could be used. And I think you don't even need to attach to a node JS container as you can run on your computer commands that should execute inside a container like this: docker compose exec , for example: docker compose exec node npm run dev we start the dev environment with docker compose up -d (first for Traefik repo, and after Traefik runs, then again docker compose up -d for each and every site we need to work on), and stop it with docker compose down. Pretty straightforward and standard. note that docker compose down removes containers and volumes, so if you use a persistent database, then you need to define a volume for the db files, so the db will not be lost after docker compose down. If it is a small/medium site that doesn't need high availability and autoscaling, this Traefik with docker-compose solution also works fine for production. The docker-compose alternatives for creating easier dev environments are Lando or DDEV but there's less documentation about those for Python projects, and they are not suitable for production but they are easier to use than docker compose. For example, they do this Traefik proxy setup by themselves, you can create scriptable commands, so you don't need to write the whole command every time like "docker compose exec python python manage.py runserver 0.0.0.0:80" but with a customly defined "lando runserver" as a simple example.
2 of 3
1
u/BowlerMission8425 -- maybe this project I am building could be useful for you: https://github.com/ogre-run/miniogre In the past, I experienced similar problems building Docker images for Python development environments. The miniogre project above reads the Python code base and automatically creates a Dockerfile, builds the image, and spins up the container.
🌐
Docker
docker.com › blog › how to “dockerize” your python applications | docker
How to “Dockerize” Your Python Applications | Docker
November 6, 2024 - CMD [“python”, “./main.py”] # Or enter the name of your unique directory and parameter set. Together, these commands and earlier arguments make up your Dockerfile. This file exists below: FROM python:3.9 # Or any preferred Python version.
🌐
University of Manchester
research-it.manchester.ac.uk › news › 2025 › 06 › 19 › getting-started-with-docker
Getting Started with Docker: Python “Hello World” Example
# Dockerfile # Use an official lightweight Python image FROM python:3.12-slim # Set the working directory inside the container WORKDIR /app # Copy the Python script into the container's working directory COPY app.py .
🌐
PyPI
pypi.org › project › docker
docker · PyPI
A Python library for the Docker Engine API. It lets you do anything the docker command does, but from within Python apps – run containers, manage containers, manage Swarms, etc.
🌐
Reddit
reddit.com › r/learnpython › is learning docker worth it for hobby python development?
r/learnpython on Reddit: is learning docker worth it for hobby Python development?
September 20, 2022 -

I've got a low frequency (6 pages per min limit) scraping script running on my pc more or less 24/7 to send me some push notifications. Now that I got the process proof of concept working with duct tape and sheer will, I've been slowly rebuilding it in parallel with better practices ex: it's just a loop with functions, no classes, testing, error catching or logging, I'm using selenium for everything but I'm moving to a mixture of selenium to load and click but faster selectorlib and easily updatelable yaml files to read the fully loaded HTML from selenium, etc, etc.

I dusted off my raspberry pi 4 and thought I could probably run a MySQL server for the data instead of a local SQLite database and maybe learn fastapi at the same time. In the past I just used the firewall to restrict to lan and had sqlalchemy connect directly to MySQL but fastapi seems like its worth learning and this seems like a good project to use it on.

I don't know what got me down the docker path but I've been researching it for about 2 weeks now to see if running a fastapi + MySQL dockers would make sense. after 2 weeks I can run containers and know the very basics of the dockerfile I still don't really understand what a development workflow in docker and vscode would look like as a single hooby dev. I'm starting to think maybe I should just run fastapi just with venv on uvicorn and MySQL without docker on the pi. Since I'm only accessing the server on lan, I'm not deploying on multiple devices or working as a team it's hard to see if knowing this extra layer is worth it. I might move the script itself over to the pi, I might make a simple crud web interface as well so maybe at that point docker will be helpful or will venv always suffice?

🌐
Docker Community
forums.docker.com › general
Any docker image with python and pip preinstalled? - General - Docker Community Forums
December 28, 2017 - Is there any docker image available which comes with pre installed python and pip. I am quite new to docker.
🌐
Medium
blog.realkinetic.com › building-minimal-docker-containers-for-python-applications-37d0272c52f3
Building Minimal Docker Containers for Python Applications | by Nick Joyce | Real Kinetic Blog
September 19, 2019 - I was recently working on a Python webserver. The requirements.txt looked something like: Flask>=1.1.1,<1.2 flask-restplus>=0.13,<0.14 Flask-SSLify>=0.1.5,<0.2 Flask-Admin>=1.5.3,<1.6 gunicorn>=19,<20 · If you search Google you will find examples of Dockerfiles that look like: FROM python:3.7COPY .
🌐
Python⇒Speed
pythonspeed.com › articles › base-image-python-docker-images
The best Docker base image for your Python application (February 2026)
February 4, 2026 - The uv package installation and venv managed tool also supports downloading and installing a copy of Python when creating a virtualenv. If you do this, you are not relying on a Docker image’s Python; you can use any base image you want. Rather, the Python install comes from the Python Standalone Build project, so it will get installed via running uv in the Dockerfile.
🌐
Sunscrapers
sunscrapers.com › blog › what-is-docker-and-how-to-use-it-with-python
What Is Docker and How to Use it With Python? | Sunscrapers
April 28, 2023 - Docker is a powerful tool for creating and deploying applications in a consistent and reproducible manner, while Python is a popular programming language with a wide range of libraries and frameworks.
🌐
Docker Hub
hub.docker.com › _ › python › tags
python Tags | Docker Hub
Python is an interpreted, interactive, object-oriented, open-source programming language.
🌐
Visual Studio Code
code.visualstudio.com › docs › containers › quickstart-python
Python in a container
November 3, 2021 - Open the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and choose Containers: Add Docker Files to Workspace...: When prompted for the app type, select Python: Django, Python: Flask, or Python: General as the app type. For this tutorial, we'll focus on the Python: General case, but will also include notes for Django and Flask. Enter the relative path to the app's entry point. This excludes the workspace folder you start from.