O'Reilly logo

Mastering Docker - Third Edition by Scott Gallagher, Russ McKendrick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using multi-stage builds

In this, the final part of our journey into using Dockerfiles and building container images, we will look at using a relatively new method for building an image. In the previous sections of this part of the chapter, we looked at adding binaries directly to our images either via a package manager, such as Alpine Linux's APK, or, in the last example, by downloading a precompiled binary from the software vendor.

What if we wanted to compile our own software as part of the build? Historically, we would have had to use a container image containing a full build environment, which can be very big. This means that we probably would have had to cobble together a script that ran through something like the following process: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required