What to put in .dockerignore

.dockerignore configured · docker.dockerignore

Why it matters

Without .dockerignore the whole directory — .git, node_modules, local .env files — is sent to the build and can end up inside the image.

How to fix it

What to do: Create .dockerignore in the project root.

.git
.env
.env.*
__pycache__/
*.pyc
*.pyo
.pytest_cache/
node_modules/
*.log
.DS_Store
dist/
build/


This speeds up builds and prevents secrets from being baked into the image.

Does your repository pass this check?

Free for public GitHub repositories, no account needed. 50+ DevOps and security checks in about ten seconds.

Related checks