This repository contains Dockerfile
s for distroless-like Python container images, for several Python versions, and helper scripts for generating those Dockerfile
s.
Note that you can already get distroless Python 3.11 from the official distroless images!
Python 3.8 - 3.12.
Currently, only x86_64
builds have been tested.
The dash
shell is included, since in general a shell is needed by elements of os.system
, and by any code that runs subprocess.run()
and friends with shell=True
.
The image necessarily comes with a Python interpreter, from which arbitrary commands may be executed even without a shell installed, so inclusion of dash
is not less secure per se.
See also a related discussion on Google's distroless repo.
Debian's libc-bin
is included, which (among other things) provides locales and /sbin/ldconfig
, the latter being needed to produce a correct /etc/ld.so.cache
.
libc-bin
is also included in Google's distroless Python images.
libgomp1
is included, as some Python wheels still expect a system install of libgomp
, for example LightGBM.
The following Python standard library packages and binaries are missing from these images,
idle[lib]
ensurepip
[lib]2to3
tkinter
turtle
turtledemo
tk
support is not provided by the installed system packages, hence idle
, tkinter
and turtle*
are also removed;
this is similar to the python3.9-minimal
and libpython3.9-stdlib
packages in Debian bullseye, and (hence) to Google's distroless Python image.
ensurepip
is removed as, by design, packages should not be installed into the image with pip
;
python3.9-minimal
and libpython3.9-stdlib
also do not provide ensurepip
.
[lib]2to3
is not expected to be used, and again is also missing from python3.9-minimal
and libpython3.9-stdlib
.
Images have partial manylinux2010
and manylinux2014
compatibility.
The following libraries are omitted on the basis that they are not typically used in a distroless context and are non-negligible in size.
See also a related discussion on the Docker Official Images for Python.
- libgl1
- libglib2.0-0
- libice6
- libsm6
- libx11-6
- libxext6
- libxrender1
"Python" is a registered trademark of the Python Software Foundation. You can view license information for Python 3 here.
Files in this repository are under AGPLv3.
The distributed images (not yet available) are licensed separately, under GPL-3+.
The images are primarily a Debian-based distribution of the
python
binary (the images are not "mere aggregations"). These binaries link against software of various licences, including, for example,libgdbm6
(GPL-3+),libkeyutils1
(GPL-2+) andlibreadline8
(GPL-3+).GPL-3+ is the resulting compatible licence.
As with all Docker images, these likely also contain other software which may be under other licences.
Some additional license information which was able to be auto-detected might be found in the repo-info
repository's python/
directory.
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licences for all software contained within.