.dockerignore

A file listing paths to leave out of the build context, like .gitignore for Docker builds.

In more detail

Put .git, local virtual environments, build output and any .env or key files in it. This speeds up builds, keeps the build cache stable and stops secrets from being copied into an image by a broad COPY . . instruction.

Example

.git
.venv
__pycache__
.env

Related terms

Taught in

References