What is Dockerfile?
A text file with instructions for building a container image layer by layer.
A Dockerfile is a text document containing sequential instructions that Docker executes to build a container image. Each instruction (FROM, RUN, COPY, ENV, EXPOSE, CMD) creates a new layer. Layers are cached, so instructions that change infrequently (e.g., installing dependencies) should come before instructions that change often (e.g., copying app code). Multi-stage builds use multiple FROM statements to produce lean final images.
Deep Dive Guide
docker security best practices
Free Tool
dockerfile linter
Related Terms
More Containers Terms
BuildKit
Next-generation Docker image build engine with parallel builds and better caching.
Container
A lightweight, isolated process that packages code and its dependencies together.
Container Image
A read-only template with layers used to create containers.
Container Registry
A repository for storing, versioning, and distributing container images.
Docker Compose
A tool for defining and running multi-container Docker applications using YAML.
Multi-stage Build
A Dockerfile pattern using multiple FROM stages to create smaller, leaner final images.
Test your knowledge of Dockerfile and 130 other DevOps concepts