01What is Docker Ignore Generator?
When you run docker build, the CLI packs up the build context (usually the whole project folder) and sends it to the builder. Docker's own docs on .dockerignore describe the fix: list paths you don't want sent, and they never reach COPY or ADD. That keeps builds faster, cache hits steadier, and things like .env and .git out of your image. This generator gives you a starting .dockerignore for one of three stacks. Pick a Project Type, add your own lines, copy the result. Nothing is sent anywhere, the text is built in your browser. Each template is a fixed list grouped under comment headings. The Node.js one excludes node_modules, npm and yarn debug logs, coverage and .nyc_output, .env, .env.local and .env*.local, editor folders, .git, Docker files, docs and Markdown, CI folders, linter and Prettier configs, tsconfig*.json, jest.config* and test files. dist, .next and out are left commented out, because many Dockerfiles build those inside the container. The Python template drops .venv, venv, env and .env, __pycache__ and *.py[cod] at any depth, build/, dist/ and egg artifacts, pytest, coverage and tox output, and mypy and ruff caches. The Go template drops bin/, *.exe, *.dll, *.so and *.dylib, test binaries and coverage files, the Air .air.toml and tmp/. vendor/ is commented out. Patterns follow Docker's rules, which are close to Go's filepath.Match plus a ** wildcard. A pattern without ** matches from the context root only. So *.md removes top-level Markdown but leaves docs/guide.md alone (docs/ is listed separately). That's why the templates write **/.DS_Store and **/__tests__ for things that show up in any folder. A quick worked example. Choose Node.js and type uploads/ and *.log on two lines in Additional Entries. The output is the full Node.js template, a blank line, then "# Custom entries" followed by uploads/ and *.log exactly as you typed them. Some honest limits. The tool doesn't read your project, so it can't tell you what your Dockerfile actually needs. Your custom lines are not checked or de-duplicated. The templates exclude docker-compose*.yml but not compose.yaml, the newer default name. And the Python and Node.js templates remove tsconfig or README files that some builds need. Read the list once before you commit it.
Developers containerizing a Node.js, Python or Go project who want a sensible .dockerignore to edit instead of starting from an empty file. The tool runs entirely in your browser, so your data never leaves your device.
02How to use Docker Ignore Generator
- Choose Node.js, Python or Go from the Project Type dropdown.
- Type any extra paths into Additional Entries, one pattern per line.
- Check the .dockerignore preview below the buttons.
- Click Copy and save the text as .dockerignore in the root of your build context.
- Click the Reset button (the circular arrow) to go back to Node.js with no extra entries.
03Worked examples
- Input:
Project Type: Node.js - Result:
# Dependencies node_modules npm-debug.log* ... # Build output (uncomment if building in Docker) # dist # .next # out ... # Misc .editorconfig .eslintrc* .prettierrc* tsconfig*.json jest.config* **/*.test.* **/*.spec.* **/__tests__ - Trimmed. Build output folders start commented out, and test files are excluded at any depth.
- Input:
Project Type: Python - Result:
# Virtual environments .venv venv env .env # Python artifacts **/__pycache__ **/*.py[cod] *$py.class *.so ... .mypy_cache .ruff_cache - Trimmed. Bytecode is matched in every folder, while *.so only matches at the context root.
- Input:
Project Type: Go - Result:
# Binary output bin/ *.exe *.dll *.so *.dylib # Test artifacts *.test *.out coverage.out coverage.html # Vendor (if building in Docker) # vendor/ ... - Trimmed. vendor/ stays commented out, so vendored modules are still sent unless you uncomment it.
- Input:
Project Type: Node.js Additional Entries: uploads/ *.log - Result:
... **/*.spec.* **/__tests__ # Custom entries uploads/ *.log - End of the output shown. Your lines are appended as typed under a "# Custom entries" heading.
- Input:
Project Type: Go Additional Entries: !README.md - Result:
... .editorconfig .air.toml tmp/ # Custom entries !README.md - End of the output shown. Because the ! line comes after README.md and *.md, it re-includes the README.
04Common use cases
- Stopping a local node_modules folder from being copied into a Next.js image, where it would clash with the npm ci run in the Dockerfile
- Keeping .env files and the .git folder out of a FastAPI image you push to a public registry
- Starting a .dockerignore for a Go service built with a multi-stage Dockerfile
- Cutting the "transferring context" step in a CI build that keeps uploading coverage reports and virtualenvs
- Making layer caching work again after unrelated files like .vscode settings kept invalidating a COPY . . step
- Giving a new repo a reviewed baseline before anyone writes the first Dockerfile
05Tips
- The file must sit at the root of the build context, not next to the Dockerfile. With docker build -f docker/Dockerfile ., it belongs in the project root.
- Delete tsconfig*.json from the Node.js output if your Dockerfile runs tsc or next build. Otherwise the build fails on a missing config.
- Use a ! line to bring one file back, like !README.md after *.md. Later lines win, so put the exception below the pattern it overrides.
- Add compose.yaml yourself if you use the newer Compose filename. The templates only cover docker-compose*.yml.
- Excluding Dockerfile and .dockerignore is safe. Docker still reads them to run the build, they just aren't copied into the context.
06Related concepts
.dockerignore, Build context, Docker layer caching, Multi-stage builds, Container image size.
Frequently Asked Questions
What is Docker Ignore Generator?
Docker Ignore Generator is a free, browser-based developer tool on AIDToolStack. Generate .dockerignore files It requires no installation or sign-up and works entirely in your browser.
Is Docker Ignore Generator free to use?
Yes. No sign-up, no fees and no usage cap.
Does Docker Ignore Generator store my data?
No. It runs in your browser; nothing is uploaded.