← Developer Tools
🚫

.dockerignore Generator — Slim Docker Build Context

Generate .gitignore files for any stack — instantly, offline, free

💡

Generate a .dockerignore to exclude secrets, node_modules, and large folders from your Docker build context — speeding up builds and preventing accidental credential leaks.

⚡ Quick Start:
STACKS8 selected
🔍
Selected stacks:
🪟 Windows 🍎 macOS 💙 VS Code 💚 Node.js ⚛️ React 🔐 .env Files 📋 Log Files 🔑 Secrets
GROUP BY CATEGORY
FORMAT
OUTPUT · .gitignore
# ============================================================
# Generated: CalcNation .gitignore Generator · 2026-03-14
# Stacks   : Windows, macOS, VS Code, Node.js, React, .env Files, Log Files, Secrets
# Format   : .gitignore
# ============================================================

# ────────────────────────────────────────────────────────────
# OS
# ────────────────────────────────────────────────────────────

# 🪟 Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp
*.lnk

# 🍎 macOS
.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*
.fseventsd

# ────────────────────────────────────────────────────────────
# IDE
# ────────────────────────────────────────────────────────────

# 💙 VS Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
.history/

# ────────────────────────────────────────────────────────────
# LANGUAGE
# ────────────────────────────────────────────────────────────

# 💚 Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnp.cjs
.pnp.loader.mjs
.yarn/cache
dist/
build/
coverage/

# ────────────────────────────────────────────────────────────
# FRAMEWORK
# ────────────────────────────────────────────────────────────

# ⚛️ React
# React build output
build/
.env.local
.env.development.local
.env.test.local
.env.production.local

# ────────────────────────────────────────────────────────────
# TOOLS
# ────────────────────────────────────────────────────────────

# 🔐 .env Files
.env
.env.local
.env.*.local
.env.development
.env.test
.env.production
!.env.example
!.env.sample

# 📋 Log Files
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# 🔑 Secrets
# Security — never commit these
*.pem
*.key
*.p12
*.pfx
*.cer
*.crt
id_rsa
id_rsa.pub
*.secret
secrets.json
secrets.yaml
*.keystore

📄 110 lines·💾 3.1 KB·📦 8 stacks·🔧 .gitignore

Frequently Asked Questions

What is a .dockerignore file?

A .dockerignore file prevents specified files from being sent to the Docker daemon during build. Without it, node_modules (hundreds of MBs) and secrets could be included in your build context, slowing builds and creating security risks.

How is .dockerignore different from .gitignore?

.gitignore tells Git what to exclude from version control. .dockerignore tells Docker what to exclude from the build context. They often overlap but serve different purposes — use the Format toggle to switch output type.

Should I always ignore node_modules in .dockerignore?

Yes — always. Your Dockerfile should run npm install during the build. Including node_modules in the build context wastes bandwidth, slows COPY commands, and can cause cross-platform binary issues.

What secrets should I always exclude?

Select the Secrets stack to exclude: *.pem, *.key, *.p12, id_rsa, *.secret, secrets.json, secrets.yaml, *.keystore. These should never appear in any Docker layer history.

Does .dockerignore affect COPY commands?

Yes. Files listed in .dockerignore are excluded from the build context — they cannot be referenced in any COPY or ADD instruction in the Dockerfile. This is why .env files that your app needs at runtime should be handled via environment variables, not COPY.