In this section, we are going to cover Dockerfile instructions one by one. Let's begin with the instruction that should be the first one in the Dockerfile we are going to create, the FROM
instruction.
The syntax for the FROM
instruction is very simple. It can have three forms. It can be as simple as that:
FROM <image>
By default, Docker will use the image
tagged latest. If you need to build upon different tags, you will need to add the tag name after the name of the image. The FROM
instruction will take this form then:
FROM <image>:<tag>
Last but not least, you can even more precisely pick the image using its digest. As you remember from the previous chapters, images with the same tag can change in time, if their author decides so. If you like to lock your base image to the fixed version, you can specify its digest as the image name. This way your own image will be always built using the specific version of the base image, regardless of tags. To specify...