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 →
Related concepts
- dockerignoreconfigured by · A .dockerignore file specifies patterns for files and directories that Docker excludes from a build context.
- docker buildused by · docker build is a Docker command that constructs a container image from a Dockerfile and its 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.
- docker-compose.ymlused by · docker-compose.yml is a declarative YAML configuration file that defines Docker Compose application services and their containers, networks, volumes, and runtime settings.
- container imageproduces · A container image is a packaged filesystem and configuration artifact from which a container can be created and run.
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.

