A build context is the directory supplied to Docker for an image build. In `docker image build --tag web-ping .`, the final `.` selects the current directory, where the Dockerfile and related application files are located. If the build cannot find them, check your working directory and make sure the final argument is present. section 3.3
Listing 11.4 Docker Compose build settings and reusable arguments
x-args: &args
args:
BUILD_NUMBER: ${BUILD_NUMBER:-0}
BUILD_TAG: ${BUILD_TAG:-local}
services:
numbers-api:
build:
context: numbers
dockerfile: numbers-api/Dockerfile.v4
<<: *args
numbers-web:
build:
context: numbers
dockerfile: numbers-web/Dockerfile.v4
<<: *args
Docker Compose can set the context to `numbers` while selecting Dockerfiles in its `numbers-api` and `numbers-web` subdirectories. This keeps the source directory and Dockerfile path explicit for each service. section 11.3
Docker sends the build context to the engine with the Dockerfile, so unnecessary files can slow a build. A precise `COPY ./app ./app` avoids putting unrelated files in the image. For a complex directory layout, `.dockerignore` can exclude files from the context instead. Deleting unwanted files in a later image layer does not recover the space they already occupy. section 17.1
Try a smaller context
Build the example image, add the supplied `.dockerignore`, then rebuild with a new tag and compare the context sent. The ignored files are no longer sent to the engine. section 17.1

