Boneyard Tools

Dockerignore Generator

Toggle the stack presets your image uses, add any custom patterns, and copy or download a clean .dockerignore. The tool ships curated blocks for General, Node, Python, Go and Java, and removes any pattern that two stacks share so each line appears only once. The file it builds shrinks your build context and keeps secrets, caches and VCS data out of the image.

How to generate a .dockerignore

  1. Click the stack pills your project uses to turn them on (General and Node are selected by default).
  2. Type any extra rules into Custom patterns, one per line, such as tmp/ or *.local.
  3. Watch the .dockerignore preview update live as you toggle stacks and edit patterns.
  4. Click Copy, or Download to save the file straight to disk.
  5. Place the .dockerignore in the same folder as your Dockerfile, at the build context root.

Examples

Go stack only

stacks: go
# Go
bin
vendor
*.test
*.out
*.exe
dist

Node and Python, shared patterns deduplicated

stacks: node, python
# Node
node_modules
npm-debug.log
...
dist
build
.next
.nuxt

# Python
__pycache__
*.pyc
...  (dist and build are dropped here, already listed under Node)

General preset plus a custom rule

stacks: general; custom: tmp/
# General
.git
.gitignore
.env
.env.*
*.log
Dockerfile
.dockerignore
README.md
LICENSE
.DS_Store

# Custom
tmp/

Frequently asked questions

Why use a .dockerignore?

It tells the Docker daemon which files to leave out of the build context that gets sent before a build. A smaller context means faster builds, and it stops secrets, logs and local caches from being copied into your image by a broad COPY . instruction.

Which stacks does the tool cover?

Five presets: General (git metadata, .env files, logs, README and license), Node (node_modules, debug logs, build output like dist, .next and .nuxt), Python (pycache, virtual envs, test caches), Go (bin, vendor, test and executable output) and Java (target, build, gradle and compiled artifacts).

How does deduplication work?

Patterns are deduplicated globally in selection order, so the first stack to introduce a pattern keeps it. If you pick Node then Python, both list dist and build, but those two lines appear only under Node. A block that is fully absorbed this way is skipped so you never get an empty header.

Do custom patterns get deduplicated too?

Yes. Custom lines are trimmed, blank lines are dropped, and each is checked against everything already emitted by the stacks above. Anything genuinely new is written in a final # Custom block at the bottom of the file.

Should I ignore the Dockerfile itself?

The General preset lists Dockerfile and .dockerignore because they are not needed inside the running image. Delete those two lines if your build deliberately copies the Dockerfile in, for example for a multi-stage step that reads it.

Does .dockerignore use the same syntax as .gitignore?

The glob patterns look similar but the rules are not identical. Docker matches paths from the build context root, treats a leading exclamation mark as a re-include exception, and does not walk parent directories the way git does. Test edge cases before relying on them.

What happens if I select nothing?

The preview shows a short prompt and the output is empty. As soon as you toggle one stack on or add a custom pattern, the file is generated with a trailing newline so it is ready to save.

Is my configuration private?

Yes. The file is assembled entirely in your browser from the built-in presets and your typed patterns. Nothing is uploaded, so project details stay on your device.

Learn more

Related tools