Build context
A Docker build context is the set of files and directories supplied to Docker as input for building a container image.
Learn Docker in a Month of Lunches, Second Edition
A build context is the directory and its contents supplied to Docker as input for building a container image.
- How it is used
- Supplies the Dockerfile and related files for image builds in local development and CI workflows.
- How deep it goes
- Defines the CLI directory argument and explains context transfer and exclusions, without detailing BuildKit internals.
- Examples
- Contrasts a Compose context with nested Dockerfiles and image builds using precise COPY or .dockerignore.
- What you can do after
- Operate/configure it by selecting a CLI or Compose context and excluding unnecessary files with .dockerignore.
Read how Learn Docker in a Month of Lunches, Second Edition explains build context →
Kubernetes in Action, Second Edition
A build context is the set of files and directories supplied to Docker for building a container image.
- How it is used
- Uses a directory of application artifacts as Docker’s input for building a container image.
- How deep it goes
- Explains directory selection, daemon upload, remote-daemon implications, and performance impact without detailing context filtering internals.
- Examples
- Demonstrates `docker build -t kiada:latest .` with `app.js`, an `html` directory, and a minimal Dockerfile.
- What you can do after
- Builds a tagged container image from a local directory using the Docker CLI.
Read how Kubernetes in Action, Second Edition explains build context →
Also covered in
What to know first
- containerA software container is an isolated execution environment that packages an application and its dependencies, typically sharing the host operating-system kernel.
Related concepts
- docker buildused by · docker build is a Docker command that constructs a container image from a Dockerfile and its build context.
- dockerignoreconfigured by · A .dockerignore file specifies patterns for files and directories that Docker excludes from a build context.
- Compose override fileconfigured by · A Compose override file is a Docker Compose configuration file that modifies or extends settings from another Compose file for a particular environment.
- container imageproduces · A container image is a packaged filesystem and metadata artifact from which a container can be created and run.
- docker-compose.ymlused by · A YAML configuration file that declares services and related settings, such as networks and volumes, for a multi-container application.
Questions about build context
What is build context?
A Docker build context is the set of files and directories supplied to Docker as input for building a container image.
Which Manning books explain build context?
Learn Docker in a Month of Lunches, Second Edition and Kubernetes in Action, Second Edition.
What should I know before learning build context?
Manning books that teach build context usually introduce container first.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

