Keeping Images Small
- Use a suitable minimal base image.
- Use multi-stage builds.
- Keep the build context small with .dockerignore.
- Remove package caches when appropriate.
- Install only production dependencies in the final stage.
Smaller images can improve transfer time and reduce the amount of software that needs to be scanned and maintained.
ADVERTISEMENT