Dockerfile
Also known as: docker file, container build file, Dockerfile recipe
A Dockerfile is a plain-text script of step-by-step instructions that Docker follows to build a container image — a packaged, runnable copy of an app with its operating system, libraries, and dependencies included.
- Plain-text recipe for building a container image
- Bundles an app with its OS, libraries, and dependencies
- The built images, not the file, take real disk space
What a Dockerfile does
A Dockerfile is the recipe for a container image. Each line is an instruction: pick a base operating system, copy in the app’s files, install dependencies, and define the command that runs when the container starts. Running `docker build` executes those steps and produces an image.
The result is a portable, self-contained bundle that runs the same way on any machine with Docker, which is why it is popular for shipping and deploying software consistently.
File vs image vs container
These three are easy to confuse. The Dockerfile is the text recipe. The image is the built result of that recipe. A container is a running instance of an image. The Dockerfile itself is tiny plain text; the images it builds are what take real disk space.
On a developer’s machine, unused images and build caches are the part that piles up, not the Dockerfile. Tools like `docker system prune` reclaim that space without touching your Dockerfiles.