Dockerfile
As you will remember from Chapter 1, Introduction to Docker, the Dockerfile
is kind of a recipe to build an image. It's a plain text file containing instructions which are executed by Docker in the order they are placed. Each Dockerfile
has a base image that the Docker engine will use to build upon. A resulting image will be a specific state of a file system: a read-only, frozen immutable snapshot of a live container, composed of layers representing changes in the filesystem at various points in time.
The image creation flow in Docker is pretty straightforward and consists basically of two steps:
- First, you prepare a text file named
Dockerfile
, which contains a series of instructions on how to build the image. The set of instructions you can use in theDockerfile
is not very broad, but sufficient to fully instruct Docker how to create an image. - Next, you execute the
docker build
command to create a Docker image based on theDockerfile
that you have just created. Thedocker build
...