When assembling an image, whether using docker commit or export, optimizing the outcome in a managed way is a challenge, let alone integrating it with a CI/CD pipeline. A Dockerfile represents the building task in the form of code, which significantly reduces the difficulty of building tasks for us. In this section, we'll describe how to map Docker commands into a Dockerfile and take a step towards optimizing it.
Working with a Dockerfile
Writing your first Dockerfile
A Dockerfile consists of a series of text instructions to guide the Docker daemon to form an image, and a Dockerfile must start with the FROM directive. For example, we may have an image built from the following one-liner:
docker commit $( ...