When assembling an image, whether by a Docker commit or export, optimizing the outcome in a managed way is a challenge, let alone integrating with a CI/CD pipeline. On the other hand, Dockerfile represents the building task in the form of as-a-code, which significantly reduces the complexities of building a task for us. In this section, we will describe how to map Docker commands into a Dockerfile and go a step further to optimizing it.
Working with Dockerfile
Writing your first Dockerfile
A Dockerfile consists of a series of text instructions to guide the Docker daemon to form a Docker image. Generally, a Dockerfile is and must be starting with the directive FROM, and follows zero or more instructions. For example, we may...