Understanding common Dockerfile keys
In this section, we will take a look at the most important keys and their best practices. For full reference, it is better to review the documentation provided by Docker Inc. (https://docs.docker.com/engine/reference/builder/).
Container runtimes can create container images by reading a series of instructions written in a Dockerfile. Following this recipe-like file, a container runtime will assemble a container image.
FROM
All Dockerfiles always start with a FROM
key. This key is used to set the base image and initialize the build process. We can use any valid container image as a valid value for the FROM
key, and a scratch
keyword is reserved to build images based on an empty layer.
A Dockerfile can include multiple image build processes, although usually, we will use different files for each process.
We can refer to images using their names and tags, and we can include their digests to ensure image uniqueness. If no tag is used...