# .dockerignore

> What is a .dockerignore file, and why does it matter for build speed, cache hits and security?

Canonical: https://www.internhack.in/learn/interview/docker-containers/docker-ignore-file
Last updated: 2026-11-28

Difficulty: Beginner

## Question

What is a .dockerignore file, and why does it matter for build speed, cache hits and security?

*The full answer is for InternHack members. Open the page link above to read it.*

## Concepts covered

.dockerignore, Build context, BuildKit, Cache invalidation, Secret leakage

Previous: [Layering & Copy-on-Write](https://www.internhack.in/learn/interview/docker-containers/docker-storage-layers-copy-on-write) · Next: [Exec Form vs. Shell Form](https://www.internhack.in/learn/interview/docker-containers/docker-exec-vs-shell-form) · [All of Docker & Containers](https://www.internhack.in/learn/interview/docker-containers)

## More Docker & Containers questions

- [Bind Mount Permissions](https://www.internhack.in/learn/interview/docker-containers/docker-bind-mount-permissions)
- [Cleanup Commands](https://www.internhack.in/learn/interview/docker-containers/docker-prune-cleanup)
- [Restart Policies](https://www.internhack.in/learn/interview/docker-containers/docker-container-restart-policy)
- [Inspecting Network](https://www.internhack.in/learn/interview/docker-containers/docker-inspect-network)
- [ARG vs. ENV](https://www.internhack.in/learn/interview/docker-containers/docker-build-args-vs-env)
- [Docker Diff](https://www.internhack.in/learn/interview/docker-containers/docker-diff-command)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Docker & Containers](https://www.internhack.in/learn/interview/docker-containers)
