🌐
Docker Hub
hub.docker.com › _ › python
python - Official Image | Docker Hub
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained). Some additional license information which was able to be auto-detected might be found in the repo-info repository's python/ directory⁠.
Discussions

is learning docker worth it for hobby Python development?
basic docker is a very accessible and useful skill just in general More on reddit.com
🌐 r/learnpython
40
138
September 20, 2022
Setup a Python environment with Docker

https://containers.dev/

Natively supported with VS Code.

More on reddit.com
🌐 r/Python
44
129
January 23, 2023
Docker for Pythonistas

There are already created official docker images for all major python versions:

  • https://registry.hub.docker.com/_/python/

There are also very usefull 'onbuild' versions.

More on reddit.com
🌐 r/Python
4
19
February 2, 2015
How do you use python dependencies in a docker image?
How do I know which python is being used when I call this command That would depend on a few things: The shebang (the first line in the file normally) The PATH variable in the env of the running command What is installed on that container In this case, the ENTRYPOINT as that is non-default Normally I would suggest running something like: docker run -it cytopia/mypy sh However, I tried it and it didn't work for me, because they have configured a custom ENTRYPOINT, instead you can do this: docker run -it --entrypoint '/bin/sh' cytopia/mypy This gives me a shell that I can use to check out the env: /data # echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /data # which python /usr/bin/python /data # python Python 3.10.9 (main, Dec 10 2022, 13:54:12) [GCC 11.2.1 20220219] on linux Anyway, the files they use to create the image can be found here I think (this one is for 3.10): https://github.com/cytopia/docker-mypy/blob/master/Dockerfiles/Dockerfile.python3.10 and how can I install the required dependencies to this particular python installation so mypy can run properly The normal way to do this would be to create a new DockerFile, which uses the image you want as the FROM and then adds dependencies. The image itself is based on alpine linux (a secure and lightweight focused linux often used for building small images) and so you would want to install stuff using apk I believe: FROM cytopia/mypy RUN apk add py3-pip && pip install numpy For example will create a new image with numpy installed for you I am not sure why I had to install pip... I can see it gets installed in the DockerFile and when I tried to use pip in my container, I got an error that it couldn't be found... Beware, that each time you use RUN, it creates a new layer. If you create a new layer and create a load of cache files on that layer they will make your image very big, you will want to tidy up each layer as you go (but I guess that's something you will learn as you go) You would then be able to run your previous docker run with the new image you have built with the dependencies installed More on reddit.com
🌐 r/docker
4
17
January 16, 2023
🌐
Docker
docker.com › blog › how-to-dockerize-your-python-applications
How to “Dockerize” Your Python Applications | Docker
Downloadable packages are available at Python.org for all mainstream OSes: ... The latest version of Docker Desktop, for either Windows or macOS (Intel or M-series processor).
Published   November 6, 2024
🌐
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. Contribute to docker/docker-py development by creating an account on GitHub.
Starred by 7.2K users
Forked by 1.7K users
Languages   Python
🌐
Docker
docs.docker.com › guides › python › containerize your app
Containerize your app | Docker Docs
ENV PYTHONUNBUFFERED=1 WORKDIR /app # Create a non-privileged user that the app will run under. # See https://docs.docker.com/go/dockerfile-user-best-practices/ ARG UID=10001 RUN adduser \ --disabled-password \ --gecos "" \ --home "/nonexistent" \ --shell "/sbin/nologin" \ --no-create-home \ --uid "${UID}" \ appuser # Download dependencies as a separate step to take advantage of Docker's caching.
🌐
Docker
hub.docker.com › search
Explore Docker's Container Image Repository | Docker Hub
ActiveState's customizable, low-to-no vulnerability container image for python. ... Dockerfiles for CPython of lysnikolaou's tag-strings-rebased branch.
🌐
PyPI
pypi.org › project › docker
docker · PyPI
Maintainer: Docker Inc. ... A Python library for the Docker Engine API.
      » pip install docker
    
Published   May 23, 2024
Version   7.1.0
🌐
Docker
docs.docker.com › guides › python
Python | Docker Docs
This guide is a community contribution. Docker would like to thank Esteban Maya and Igor Aleksandrov for their contribution to this guide. The Python language-specific guide teaches you how to containerize a Python application using Docker.
Find elsewhere
🌐
Visual Studio Code
code.visualstudio.com › docs › containers › quickstart-python
Python in a container
November 3, 2021 - Build, run, and verify the functionality of a Django, Flask, or General Python app. Debug the app running in a container. Install Docker on your machine and add it to the system path.
🌐
Docker Docs
docs.docker.com › reference › samples › python samples
Python samples | Docker Docs
Docker Samples: A collection of over 30 repositories that offer sample containerized demo applications, tutorials, and labs.
🌐
Django Stars
djangostars.com › home › docker tutorial: using docker with python
Python Docker Tutorial: How to Use Docker with Python | Django Stars
September 11, 2025 - This is an introductory Python Docker tutorial. By the end of this article, you will know how to use Docker on your local machine. Along with Python, we are going to run Nginx and Redis containers. Those examples assume that you are familiar with the basic concepts of those technologies.
🌐
Docker
docker.com › blog › containerized-python-development-part-1
Containerized Python Development - Part 1 | Docker
May 24, 2024 - To generate a Docker image we need to create a Dockerfile which contains instructions needed to build the image. The Dockerfile is then processed by the Docker builder which generates the Docker image.
🌐
Real Python
realpython.com › tutorials › docker
Python Docker Tutorials – Real Python
Create a Dockerfile that installs Python, copies your code, installs dependencies, and sets an entrypoint.
🌐
Docker
docs.docker.com › guides › python › develop your app
Use containers for Python development
CMD ["python3", "-m", "uvicorn", "app:app", "--host=0.0.0.0", "--port=8001"] Hide · Create a file named compose.yaml with the following contents. ... # Comments are provided throughout this file to help you get started. # If you need more help, visit the Docker Compose reference guide at # https://docs.docker.com/go/compose-spec-reference/ # Here the instructions define your application as a service called "server".
🌐
TestDriven.io
testdriven.io › blog › docker-best-practices
Docker Best Practices for Python Developers | TestDriven.io
February 12, 2024 - Multi-stage Docker builds allow you to break up your Dockerfiles into several stages. For example, you can have a stage for compiling and building your application, which can then be copied to subsequent stages. Since only the final stage is used to create the image, the dependencies and tools associated with building your application are discarded, leaving a lean and modular production-ready image. ... # temp stage FROM python:3.12.2-slim as builder WORKDIR /app ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 RUN apt-get update && \ apt-get install -y --no-install-recommends gcc COPY requirements.txt .
🌐
Simplilearn
simplilearn.com › home › resources › software development › how to run a python script using docker: all you need to know
What Is Docker Python: How to Create and Run it? | Simplilearn
November 18, 2025 - Learn how Docker Python is used for automating the deployment of any application inside a software container. Read on to know how to create and run it.
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Earthly
earthly.dev › blog › python-docker
Running Python on Docker - Earthly Blog
July 24, 2023 - Test the app to see if it works by using python3 -m flask run --host=0.0.0.0 --port=5000 and then navigating to http://localhost:5000 in your preferred browser: And it works! Now that the Dockerfile, requirements.txt, and app.py have been created, you should test the Python app on your local environment to make sure it works.
🌐
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).
Starred by 2.7K users
Forked by 1.1K users
Languages   Dockerfile 50.3% | Shell 49.7%
🌐
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?