a .dockerignore file Explained

What a .dockerignore file does, with an example.

Published November 9, 2026

a .dockerignore file lists files and directories to exclude from the build context sent to Docker, similar to .gitignore.

Key points

  • Part of the standard Docker CLI used for building, running, and managing containers

Example

node_modules
.git
*.log
More General articles