The most lightweight python docker image possible
Tiny Python Docker image ========================
The most lightweight Python 3 Docker image possible.
.. image:: https://github.com/CrafterKolyan/tiny-python-docker-image/actions/workflows/update-repository.yml/badge.svg?branch=main :target: https://github.com/CrafterKolyan/tiny-python-docker-image/actions/workflows/update-repository.yml
Possible variants
.. csv-table:: :header: Dockerfile,Description,Size,Version :widths: 10, 70, 10, 10
Dockerfile.scratch-minimal,Minimal Python image with almost no libraries from scratch,6.587 MB,3.14.5 Dockerfile.scratch-full,Smallest Python image with default libraries from scratch,23.38 MB,3.14.5 Dockerfile.haizaar-minimal,Stripped official Python image (haizaar/python-minimal_),37.56 MB,3.14.6 Dockerfile.python-alpine,Python Alpine-based Official,47.6 MB,3.14.6 Dockerfile.alpine,Alpine-based,49.61 MB,3.14.5 Dockerfile.python-slim,Minimal packages needed to run python,119.3 MB,3.14.6 Dockerfile.ubuntu,Ubuntu-based,141.6 MB,3.14.4 Dockerfile.python,Python Debian-based Official with a lot of packages,1117 MB,3.14.6
Requirements
- Docker
Building image
` .. code-block:: bash
docker build -t python-tiny . -f <Dockerfile name>
For example:
.. code-block:: bash
docker build -t python-tiny . -f Dockerfile.scratch-full
Running image <pre><code class="lang-"></code></pre><pre><code class="lang-"></code></pre>
.. code-block:: bash
docker run --rm -it python-tiny
Technologies
- Docker
- :code:
ldd(prints the shared libraries required by each program or shared library specified on the command line): used to create :code:scratch-fulland :code:scratch-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/
- https://github.com/jfloff/alpine-python
- https://github.com/haizaar/docker-python-minimal