About this tool
Create a .dockerignore tailored to your stack to shrink the build context and speed up docker build.
This generator builds a sectioned .dockerignore file from your toolchain (Node, Python, Go, Rust, Java, .NET, PHP, Ruby) plus cross-cutting groups for version control, secrets, editor clutter, CI configs and logs. Patterns follow the Docker build-context rules — Go filepath.Match syntax extended with ** and ! negation, matched relative to the context root — and duplicates across selections are removed automatically.
Open Dockerignore Generator on AltFTool — it loads instantly in your browser.
Paste your code or data sample into the workspace.
Pick the format, conversion, or analysis you need.
Copy the polished result straight back into your project.
Each toolchain gets its documented local artifacts: node_modules, __pycache__, Rust target/, .NET bin/ and obj/, and more.
The env group excludes .env files and private keys, preventing accidental COPY . leaks into images.
Overlapping patterns (like target/ from Rust and Maven) appear once, under a commented section header.
It excludes files from the build context that the Docker client sends to the daemon (or BuildKit) before a build, so ignored files cannot be COPYed into the image and do not slow the upload. On large projects excluding .git and dependency folders routinely cuts the context from hundreds of megabytes to a few.
Yes, in the standard workflow where the Dockerfile runs npm ci or npm install inside the image — the host's node_modules may contain platform-specific binaries that break the container. The one exception is a Dockerfile that deliberately COPYs a prebuilt node_modules or bundle, which would then fail.
It is similar but not identical: .dockerignore uses Go's filepath.Match rules extended with ** for any number of directories and ! for exceptions, matched against paths relative to the context root. Notably, a bare name like node_modules matches only at the root — use **/node_modules to ignore it at any depth.
You can list Dockerfile and .dockerignore to shrink the context slightly, and modern BuildKit still builds fine because it reads the Dockerfile directly rather than from the context. Avoid this only if some tooling in your pipeline expects the Dockerfile inside the context.