Using alpine as base Docker image
13 Apr 2017 • permalink
I recently updated all of my personal Dockerfiles that I have for multiple purposes to use
alpine as base image.
Prior this, I just use
ubuntu as the base image and don’t have much care about built-images size. However, using Kubernetes, having small images size can make rolling out update speed much faster.
Some tips for reducing Docker image size that I found during my research:
- Using smaller base image (alpine, busybox, etc..)
- Remove unnecessary dependencies that you use for compiling stuff after done. (Also remove cache)
- Use few layers as possible. However, I don’t think you should do it blindly just for the shake of small image size and destroy readability. I prefer to keep it simple and clean. Optimize it later for building only.