Skip to content

The most lightweight python docker image possible

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-haizaar
Notifications You must be signed in to change notification settings

CrafterKolyan/tiny-python-docker-image

Repository files navigation

Tiny Python Docker image

The most lightweight Python 3 Docker image possible.

image

Possible variants

Dockerfile Description Size Version
Dockerfile.scratch-minimal Minimal Python image with almost no libraries from scratch 7.266 MB 3.12.3
Dockerfile.scratch-full Smallest Python image with default libraries from scratch 23.19 MB 3.12.3
Dockerfile.haizaar-minimal Stripped official Python image (haizaar/python-minimal) 39.04 MB 3.12.3
Dockerfile.alpine Alpine-based 48.41 MB 3.12.3
Dockerfile.python-alpine Python Alpine-based Official 51.73 MB 3.12.3
Dockerfile.ubuntu Ubuntu-based 116.5 MB 3.12.3
Dockerfile.python-slim Minimal packages needed to run python 130.2 MB 3.12.3
Dockerfile.python Python Debian-based Official with a lot of packages 1019 MB 3.12.3

Requirements

  • Docker

Usage

Building image

docker build -t python-tiny . -f <Dockerfile name>

For example:

docker build -t python-tiny . -f Dockerfile.scratch-full

Running image

docker run --rm -it python-tiny

Technologies

  • Docker
  • ldd (prints the shared libraries required by each program or shared library specified on the command line): used to create scratch-full and scratch-minimal images.