The most lightweight Python 3 Docker image possible.
| Dockerfile | Description | Size | Version |
|---|---|---|---|
| Dockerfile.scratch-minimal | Minimal Python image with almost no libraries from scratch | 2.691 MB | 3.14.10 |
| Dockerfile.scratch-full | Smallest Python image with default libraries from scratch | 10.54 MB | 3.14.10 |
| Dockerfile.haizaar-minimal | Stripped official Python image (haizaar/python-minimal) | 14.69 MB | 3.15.2 |
| Dockerfile.python-alpine | Python Alpine-based Official | 19.68 MB | 3.15.2 |
| Dockerfile.alpine | Alpine-based | 20 MB | 3.14.10 |
| Dockerfile.python-slim | Minimal packages needed to run python | 44.31 MB | 3.15.2 |
| Dockerfile.ubuntu | Ubuntu-based | 56.98 MB | 3.14.4 |
| Dockerfile.python | Python Debian-based Official with a lot of packages | 419 MB | 3.15.2 |
- Docker
docker build -t python-tiny . -f <Dockerfile name>For example:
docker build -t python-tiny . -f Dockerfile.scratch-fulldocker run --rm -it python-tiny- Docker
ldd(prints the shared libraries required by each program or shared library specified on the command line): used to createscratch-fullandscratch-minimalimages.
- https://xebia.com/blog/how-to-create-the-smallest-possible-docker-container-of-any-image/
- https://xebia.com/blog/create-the-smallest-possible-docker-container/