.dockerignore Generator
Create a .dockerignore to keep your Docker build context small and fast. Choose a preset tuned for a common stack (Node, Python, Java, Go or generic), start from the sensible defaults, and prepend or append your own glob patterns. The generator explains why each pattern matters and warns about common pitfalls like ignoring files you still need in the image.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
What the generator writes
The tool emits a ready-to-save .dockerignore file with a short header naming the tool, then groups patterns into commented sections such as Version control / CI, Dependencies, Build output and Local env / tools. Every line is a glob the Docker daemon honours when it assembles the build context, so the upload and the build work with far fewer bytes. The result is returned as plain text you can copy, with stats counting the total patterns and how many came from the preset versus your own additions.
Stack presets and the patterns they carry
Pick a preset that matches the project and you start from a sensible default rather than a blank page. The Node preset excludes node_modules, the npm, yarn and pnpm debug-log patterns, and build output like dist, .next and storybook-static; Python skips __pycache__, .venv and the mypy, pytest and ruff caches; Java drops target and .gradle; Go removes vendor and coverage files; and generic covers the cross-language essentials. Each preset also excludes the Dockerfiles themselves, so the context is not copied back into the image, while .env.example is re-included with a negation so your example file survives.
Trimming and customising the output
Turning off the include common dotfiles option filters every pattern whose name starts with a dot, which gives a leaner list when you already rely on a separate mechanism for VCS metadata. Section comments can be removed entirely for a minimal file. Anything you add in the Extra patterns box, one glob per line, is appended under a Custom heading and counted separately, so you can layer project-specific exclusions such as local-data/ or build artifacts on top of the preset. Leading and trailing whitespace is trimmed and blank lines are dropped from that box.
What it will and will not do
A .dockerignore shrinks what Docker sends as the build context; it does not remove files from image layers that earlier Dockerfile steps already added, so a lean ignore list is a starting point, not a substitute for a multi-stage build. Presets are tuned for the most common layouts and are not exhaustive — review the output for anything your stack generates elsewhere. Everything runs on your device from the preset tables shipped with the page, so nothing you generate is uploaded and no network request is made.
Questions
What does a .dockerignore actually do?
It excludes files from the build context sent to the Docker daemon, shrinking the upload and the image build. It does not remove files already in the image from earlier layers.
Do I need .gitignore in it?
Usually yes — .git, .gitignore and other VCS/CI metadata rarely belong in a build context. The preset includes them; you can toggle sections with the options.
Is this the same as a .gitignore?
Related but different: .gitignore keeps files out of version control; .dockerignore keeps them out of the Docker build context. Both are here — check the gitignore tool for the former.
Related tools
See categorydocker-compose.yml Generator
Build a docker-compose.yml for one service — image, ports, environment, volumes and restart policy.
Dockerfile Generator
Build a Dockerfile from friendly fields — base image, workdir, env, ports, RUN steps and CMD — ready to paste.
.gitignore Generator
Generate a .gitignore for Node, Python, Rust, Go, Java, macOS, Windows and more.
.editorconfig Generator
Generate an .editorconfig with your indentation, line-ending and charset settings.