Interview Prep/Docker/Dockerfile Instructions & Builds

What does `.dockerignore` do?

BeginnerConceptDockerfile Instructions & Builds
Answer

It excludes files from the build context using gitignore-like patterns, speeding up builds, preventing cache invalidation from irrelevant changes, and keeping secrets out.

.git
node_modules
**/*.log
.env
Dockerfile*
!Dockerfile

Patterns are relative to the context root and ! re-includes a path.

All Docker questions Roadmap: Docker & containers

More on Dockerfile Instructions & Builds