Dockerfile
Dockerfile is a text file that contains a set of instructions used to create a Docker image. A Docker image is a read-only template that contains a set of instructions for creating a container.
The Dockerfile consists of a series of commands that specify how to build the image. Some common commands include FROM to specify the base image, COPY to copy files into the image, RUN to execute commands inside the image, EXPOSE to expose ports, and CMD to run the default command when starting a container from the image.
For example, a Dockerfile might start with FROM ubuntu which tells Docker to use the ubuntu image as the base. It could then use COPY to add application files, RUN to install required packages, and EXPOSE to open port 80. The final CMD specifies the command to run the application when a container is started from the image.
The Dockerfile makes it easy to automate and replicate builds. By checking the Dockerfile into version control, anyone can recreate the same image by running docker build. This promotes consistency across development, testing, and production environments.