build context
The set of files you hand to docker build, usually the current directory given as the final dot.
In more detail
Only files in the context can be copied into the image, and the whole context (minus .dockerignore entries) is sent to the builder, so a stray node_modules folder or .git directory makes builds slow and can leak secrets into the image. Not the same as a Docker context, which picks a daemon.
Example
docker build -t taskapi:0.1 . # the dot is the contextRelated terms
- .dockerignore — A file listing paths to leave out of the build context, like .gitignore for Docker builds.
- docker build — The command that builds an image from a Dockerfile and a build context.
- COPY — The Dockerfile instruction that copies files from the build context into the image.
- Docker context — A saved setting that tells the Docker CLI which Docker daemon to talk to.
Taught in
- Container Images The Exam Way — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Build Context, Dockerignore And Your First Dockerfile — Docker Architecture & Production Containers
- FROM, WORKDIR, COPY And ADD — Docker Architecture & Production Containers
- Minimal Bases, Non Root Users And Smaller Images — Docker Architecture & Production Containers
- Ephemeral Filesystems And Named Volumes — Docker Architecture & Production Containers
- Harden And Deliver The Complete Service Stack — Docker Architecture & Production Containers