Shrinking your Python application’s Docker image: an overview

You’ve finished building the initial Docker image for your Python application, you push it to the registry–and that takes a while, because your image is 2GB.
Your image is clearly too large, and so your next step is to try to make your Docker image smaller.

In this article you’ll find an overview of the many techniques you can use to shrink your image, organized approximately by logical order packaging.
The focus is on Python, though many of these techniques are more generic.
Techniques are broken down by category, with each suggesting follow-up articles covering the details:

  1. Base image.
  2. Docker layers and their impact on image size.
  3. System packages (apt/dnf) and Python packages.
  4. Avoid copying unnecessary files.
  5. Additional tools, tips, and techniques.

Before you begin: should image

 

 

 

To finish reading, please visit source site