by winddude · 4y ago · 0 comments
You should optimise for performance and security. For example python's base image is slower, than a container built on ubuntu for python apps. This is shown by several tests. Pythons base image is built on Alpine, which has shown to also have longer build times, and obscure bugs.
So a smaller container image is not always better. Instead optimise for performance and security.
No one said it is _always_ better. Obviously you can make a smaller but worse image.
Making the image smaller, without affecting its performance or security, can reduce costs (storage + network) and can make deployments much faster (and so improve reliability, and Developer Experience).
The Python image on Docker Hub has Debian, Alpine, and Windows Server versions: https://hub.docker.com/_/python
The default (`python:latest` or `python:3.10`) is using Debian bullseye. You need to ask for Alpine by using a specific tag (`python:3.10-alpine`).
When updating images on multiple devices on a 10 Mbit connection the difference between, say, a 500 MB image and a functionally equivalent 50 MB image can be quite significant.