Making efficient final images
Most blogs and manuals will recommend you the simpler approaches to reducing the image of your docker image. We’ll go a little further today but let’s reiterate them anyway:
- Use the reduced version of base images (alpine usually recommended), avoid SDKs for final images
- Use multistage build, do not copy over temporary files or sources
- Take care of the .dockerignore, ignore as much as possible
Having said that, it is possible that you’ll still end up with a very huge docker image, and it’s difficult to understand what the next step from here.
This is where this post comes in.