Lean Python Container: Creating 10x smaller Python containers

By Jordan H. Ferenz

Elevator Pitch

Forget everything you know about containerizing Python code - there is a better way. Smaller images mean pods are ready faster and hosts preserve more disk space. Creating small container images with scientific Python libraries is easier than you think.

Description

Containers are today’s goto method of distributing software on the cloud. But are we using this tool correctly? Container images should be mobile and easily moved around. To achieve this we want the image size to be as small as possible. Most tutorials on containerizing Python advice to use the official Python image. To reduce the image size, some recommend using the python-alpine image.

For me, none of those options were good enough. I set to package our python services in container images less than 100MB in size. It was an interesting process, but I succeseeded and want to share the knowledge.