Reduce the size of the Docker Image
Briefly

To effectively reduce the size of your Docker images, you should consider minimal base images like Alpine or even better options like distroless images that only include your application and its runtime dependencies.
Using distroless as a base image significantly enhances security by eliminating unnecessary programs and reducing the attack surface. This avoids the vulnerabilities often found in general-purpose distributions.
Combining multiple RUN commands in Dockerfiles minimizes the number of layers created. This optimization technique can significantly decrease the size of the final image while improving build times.
For practical comparison, switching from Ubuntu (128MB) to Alpine (5MB) can drastically reduce size, and selecting distroless can further compress it down to around 2.51MB.
Read at Medium
[
]
[
|
]