17 Optimizing your Docker images for size, speed, and security
Once you have your apps containerized with a CI/CD process to deploy to a container platform, you may think that you’re good to go to production, but there are some best practices you still need to invest time in. Optimizing your Docker images is one of the most important, because you need your builds and deployments to be fast, your application content to be secure, and your evenings free to call your own—you do not want to be paged at 2 a.m. when your servers have run out of disk space. The Dockerfile syntax is small and intuitive, but it hides some complexity that you need to understand to make the most of your image builds.
This chapter will walk you through the finer details of the image format so that you know how and why to optimize it. We’ll be building on chapter 3, where you learned that Docker images are actually merged from multiple image layers.