Home / Companies / Codefresh / Blog / Post Details
Content Deep Dive

Docker Multi-Stage Builds

Blog post from Codefresh

Post Details
Company
Date Published
Author
Will Kinard
Word Count
802
Language
English
Hacker News Points
-
Summary

Docker's release of version 17.05 introduced the highly anticipated multi-stage builds feature, which simplifies the process of creating optimized Docker images. Traditionally, Docker images were created using single-stage builds, where Dockerfiles, employing a Domain-Specific Language (DSL), outlined commands to construct an image. This approach often resulted in large images because they incorporated both build tools and the final application, causing storage inefficiencies. The new multi-stage builds allow users to define multiple stages within a single Dockerfile, thereby separating the build environment from the production environment. This results in smaller, more secure images by enabling the removal of unnecessary build tools from the final image. Multi-stage builds streamline the process by allowing for the construction of images that adhere to best practices without the need for additional Dockerfiles or scripts. This advancement is particularly beneficial for platforms like Codefresh, which fully supports these builds and integrates them seamlessly into its pipelines, offering an efficient solution for developers seeking to optimize their Docker images.