# docker-library/python: the Docker Official Image for Python

> The docker-library/python repository builds and publishes the Docker Official Image for python. It is packaging, not a Python distribution, and the README points users to Docker Hub for actual usage.

**docker-library/python** — Docker Official Image packaging for Python

- Repository: https://github.com/docker-library/python
- Website: https://www.python.org/
- Stars: 2,782 · Forks: 1,107
- Language: Dockerfile
- License: MIT
- Published: 2026-09-28 · Updated: 2026-09-28 · Language: en
- Canonical page: https://hysenlabs.com/projects/docker-library-python

## What docker-library/python actually is, and who it is for

This repository is the source for the Docker Official Image named python on Docker Hub. The README states it is maintained by the Docker Community and is not to be confused with any official python image provided by python upstream. That distinction matters. If you are looking for CPython source, packaging, or release tooling, this is the wrong repository. If you are looking for the Dockerfile templates and version definitions that produce the python image you pull, this is the right one.

The audience is narrow and specific. It is for people who build or mirror Python container images, who need to know which Python versions the Official Image covers, and who want to inspect how those images are assembled rather than trust a black box. The top-level entries show directories 3.10 through 3.14 plus a 3.15-rc directory, alongside Dockerfile-linux.template and Dockerfile-windows.template. That layout tells you the project supports multiple Python minor versions and two operating system targets, and that the per-version Dockerfiles are generated from templates rather than hand-written.

## How the image is built: templates, versions.json and apply-templates.sh

The architecture is a generation pipeline, not a single Dockerfile. Two templates, Dockerfile-linux.template and Dockerfile-windows.template, hold the shared build logic. A versions.json file holds the version data, and versions.sh appears to derive from it. The apply-templates.sh script renders the templates into the per-version directories such as 3.12/ and 3.13/. A second script, generate-stackbrew-library.sh, produces the library file that the official-images repository consumes.

That data flow has a practical consequence. The Dockerfiles you find inside 3.12/ or 3.13/ are outputs. Editing them directly would be overwritten the next time apply-templates.sh runs, so changes belong in the templates or in versions.json. The README also points at the library/python file in the official-images repository as the current source of truth for the image. In other words, this repository is one link in a chain that ends at Docker Hub, and the README is explicit that the full image description lives in docker-library/docs under the python directory.

The README notes the file itself is generated by generate-repo-stub-readme.sh from the docker-library/docs repository. That is why the README here is short and mostly redirects elsewhere. It is a stub by design, not an oversight.

## Installing and running the python image

The README does not contain install steps. It directs readers to the Docker Hub page for the full readme on how to use the image. What can be stated with confidence is the image name, python, and the fact that it is a Docker Official Image. The README gives no command examples, and the repository files contain no runnable usage snippet either. Rather than reproduce commands that cannot be traced to this repository, the honest position is that the Docker Hub description is where usage instructions live.

The repository layout does carry one usable fact: the version directories run from 3.10 through 3.14 plus 3.15-rc, so the image is published along those version lines. That is the extent of what this repository tells you about selecting a tag. Entrypoint behaviour, working directory conventions, volume mounts and environment variables are not documented here at all.

If you need those details before adopting the image, read the Docker Hub page for python and the python directory in docker-library/docs. Those are the two locations the README names as authoritative. Anything beyond the image name and the version lines would be guesswork from this repository alone.

## Where this repository is the wrong tool

The README is a stub and says so indirectly by pointing to Docker Hub and to docker-library/docs. Anyone who needs usage documentation, environment variable listings, or entrypoint details will not find them here. That is a genuine limitation, not a documentation gap that a pull request would fix, since the file is generated.

The second limitation is version scope. The version directories stop at 3.14 with a 3.15-rc line. If your project needs a Python version outside that set, this repository will not help, and neither will the Official Image built from it. The README gives no statement about how long older lines remain published, so pinning to a version that later disappears from the tag list is a real risk you should verify against library/python rather than assume.

Third, this is a packaging repository. It does not control Python's own release schedule or its behaviour. Bugs in the interpreter belong upstream, and the README's note about not being confused with an upstream python image is a signal that support boundaries are split between projects.

## How it differs from building your own Python base image

The obvious alternative is writing your own Dockerfile with FROM debian or FROM ubuntu and installing Python yourself, or using a distribution's python package. The difference in approach is centralisation versus control. docker-library/python centralises the build in templates shared across ten-plus version directories and two platforms, so a change to the common build steps propagates through apply-templates.sh. A hand-written Dockerfile gives you exact control over every layer but leaves you responsible for tracking Python releases, security updates to the base, and platform differences between Linux and Windows.

The trade-off is transparency. With this repository you can read the templates and versions.json, but the image you actually run is assembled by Docker's build infrastructure and published to Docker Hub, and the README explicitly says a merged change may not appear on Docker Hub immediately, linking to the official-images FAQ entry on the change lifecycle. With your own Dockerfile the build is yours end to end, and there is no propagation delay to reason about. Neither approach is strictly better; the choice is whether you want to own the build or consume a shared one.

## Maintenance, upgrade cost and licence

The repository is not archived, and the last push was on 2026-09-01. That is recent enough that the project is being touched, and the presence of a 3.15-rc directory alongside stable lines is consistent with ongoing version tracking. The README does not state a release cadence, so anyone depending on a specific Python patch level should check library/python rather than infer timing from this repository.

Upgrade cost depends on how you consume the image. If you pin a minor version tag, moving to the next Python line means changing the tag and re-testing your application against the new interpreter. If you track a floating tag, upgrades arrive without a change on your side, which shifts the testing burden onto your runtime. The repository layout does not indicate any deprecation policy for older version directories, and the README is silent on it.

The licence is MIT, per the repository's LICENSE file. That covers the packaging files in this repository. It does not cover Python itself, which has its own licence, and it does not cover the base operating system layers inside the published image. If you redistribute an image built from this, the licence obligations of those components still apply, and the README does not summarise them. Treat MIT here as covering the Dockerfile templates and scripts only.

## Conclusion

Adopt docker-library/python when you want a community-maintained, Docker-built python image and you are comfortable reading the Docker Hub description and the library/python file rather than this repo. Do not adopt it if you need a pinned, reproducible base with documented rollback, because the README documents neither. Before use, verify the tag you intend to pull exists in library/python and check which directory under the repository (3.10 through 3.15-rc) corresponds to it.

## FAQ

### How do I install the python Docker Official Image?

The README directs users to the Docker Hub page for usage instructions, and the repository itself contains no install steps. The image is a Docker Official Image named python.

### How do I use the python image from docker-library/python?

The README defers usage details to the Docker Hub description and notes that the full image description is maintained in the docker-library/docs repository under the python directory.

### Which Python versions does docker-library/python cover?

The top-level repository entries show directories for 3.10, 3.11, 3.12, 3.13, 3.14 and 3.15-rc. The README does not state a policy for how long older lines stay published.

### Is docker-library/python the same as the official Python project?

No. The README states it is the Docker Official Image for python and is not to be confused with any official python image provided by python upstream. It is maintained by the Docker Community.

### Why is the README in docker-library/python so short?

The README notes it is generated by generate-repo-stub-readme.sh from the docker-library/docs repository. The full image description is maintained in that repository under the python directory.

## Sources

- [docker-library/python on GitHub](https://github.com/docker-library/python)
- [Issues](https://github.com/docker-library/python/issues)
- [License: MIT](https://github.com/docker-library/python/blob/master/LICENSE)
- [Project website](https://www.python.org/)
- [README](https://github.com/docker-library/python/blob/master/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/docker-library-python
