shlogg · Early preview
Sinaptia @sinaptia_dev

Optimize Your Docker Images With These 5 Tips

Optimize your Docker images with these 5 tips: .dockerignore, smaller base images (like ruby:2.6-alpine3.9), Dive tool, minimize layers & package manager tweaks. Smaller images = faster deploys!

The last episode was about how to perform everyday tasks in our containers. In this episode, we will see alternatives so we can optimize our images.
.dockerignore
The first tip to decrease the size of your image was already mentioned in the second episode of this series. Having a .dockerignore file will help you control what files you don’t want in your image, and therefore it will help you decrease the size of it.
Using smaller base images
This is obvious: using smaller base images produces smaller images. In the example we’ve been constructing, we use ruby:2.6, which is based on Debian stret...