There are some docker image types, like
*-alpine in most cases without thinking deeply, but I found there could have downside of using them yesterday and I googled about this topic.
Whenever you want to reduce docker image size, you could use alpine based image. But it doesn’t always have a merit of small size like Python:
In addition, it can have lower performance in some cases, and you should have a benchmark before using it in production environment:
- What are the most popular Docker images for Python?
- Benchmarking Debian vs Alpine as a Base Docker Image — Nick Janetakis
This type of docker image is not the smallest image, but better for security.
It doesn’t have package manager and shell (
minus OS), just executes your app.
You can usually use this image with multi stage build, and can create your own distroless docker image with Bazel.
When you want to debug with shell, you can use an image with
This is NOT a docker image type, but a tool. You might can reduce docker image size with it.
This is just a WIP conclustion, but we should always have a benchmark before using docker image in production and compare each image types pros/cons. IMO, it seems better to use distroless image for security reasons and reduce image size with docker-slim.