As we mentioned previously, building images is easy, but building good images is not. This section will guide you through the basics and provide you with tips and tricks that you can use to improve the image building process using Dockerfiles.
Dockerfile quick reference
We have already learned which methods are available for building images. For production, it is recommended to use Dockerfiles because this method provides reproducibility and we can use a code versioning methodology. We will introduce the main Dockerfile instructions in their standard order of usage:
Instruction | Description and usage |
FROM |
This instruction sets the base image and initializes a new build (we will review this concept in the Multistage building and image caches section, later in this chapter). It is the only mandatory instruction that all Dockerfiles should start with. We can use any valid image as the base image for building or the reserved scratch word to... |