Card 01/ 06

ConceptDifficulty: Beginner1 min

What a Dockerfile Is a Recipe For

Everything so far has run images someone else built. Running your own code means producing an image, and the only thing you control about that is a text file.

A Dockerfile is a list of instructions read top to bottom. Each one takes the filesystem left by the instruction above it, changes something, and hands the result down. What falls out of the bottom is the image.

It is a recipe rather than a script: it describes what the filesystem should end up containing, and it is run by docker build rather than by you.

This is why a build is reproducible in a way a setup document is not. The same file and the same base image give the same filesystem on a machine that has never seen your project.