4. Multi-Stage Dockerfiles

Overview

In this chapter, we will discuss a normal Docker build. You will review and practice Dockerfile best practices and learn to create and optimize the size of the Docker images using a builder pattern and multi-stage Dockerfile.

Introduction

In the previous chapter, we learned about Docker registries, including private and public registries. We created our own private Docker registry to store the Docker images. We also learned how to set up access and store our Docker images in the Docker Hub. In this chapter, we will be discussing the concept of multi-stage Dockerfiles.

Multi-stage Dockerfiles are a feature introduced in Docker version 17.05. This feature is preferable when we want to optimize Docker image ...

Get The Docker Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.