-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Description
When using the python:3.14-trixie image (non-slim variant), multiple Python versions are present in the final image due to the use of buildpack-deps:trixie as the base image.
In addition to the requested Python version provided by the Dockerfile, Debian-packaged Python versions are also installed via APT, which can lead to ambiguity and unexpected behavior when tools rely on /usr/bin/python3 or python3 from PATH.
Observed Behavior
The python:3.14-trixie image contains at least the following Python installations:
- Python 3.13.5-1 from the Debian
python3package - Python 3.13.5-2 from the Debian
python3.13package - Python 3.14.x installed by the Dockerfile under
/usr/local
This happens because buildpack-deps:trixie pulls in Debian’s default Python packages as part of its dependency set.
As a result:
/usr/bin/python3points to Debian’s Python (3.13)/usr/local/bin/python3points to the requested Python (3.14)- Some tooling and scripts may accidentally pick up the wrong interpreter
Expected Behavior
Ideally, the image would:
- Contain only one Python version, or
- At least not include competing Debian-provided Python interpreters by default
This would reduce ambiguity and make the runtime behavior more predictable, especially for build tools, virtual environments, and scripts that assume a single python3.
Reference
Dockerfile in question:
https://github.com/docker-library/python/blob/master/3.14/trixie/Dockerfile
Questions / Discussion Points
- Is it feasible to use
debian:trixieas the base image for the non-slim variant as well (similar to how theslimimages are built), instead ofbuildpack-deps? - Alternatively, would it be acceptable to explicitly remove Debian’s
python3/python3.13packages in the Dockerfile after the build dependencies are installed? - Is the presence of multiple Python versions in
python:*-trixieconsidered expected and stable behavior going forward?
I understand that buildpack-deps is intentionally “heavy” and optimized for build scenarios, but the resulting multiple Python installations are somewhat surprising from a runtime image consumer’s perspective.
Happy to provide a minimal reproducer or test case if that helps.
Thanks for maintaining the official Python images 🙏