All tools Developer

Dockerignore Generator

Generate a .dockerignore for your stack, plus any patterns you add.

Notes
  • Lines starting with # are comments. Later patterns override earlier ones.
  • Use ! to re-include a file excluded by an earlier pattern.

Runs in your browser. Nothing you open or type here is uploaded.

How to use

  1. Choose your stack: Node.js, Python, Go, Java or Rust.
  2. Tick the extra groups to exclude: Git files, CI configs, docs, tests, IDE files.
  3. Add custom patterns, one per line.
  4. Copy the generated .dockerignore, or download it, into your project root next to the Dockerfile.

Details

Before a build starts, Docker sends the build context, the files in your project directory, to the daemon. A .dockerignore file in the project root lists what to leave out: dependency folders, build output, test data, anything the image does not need. A smaller context uploads faster, and excluded files cannot leak into an image layer by accident. This tool assembles the standard patterns for your stack, adds the extra groups you tick, and appends your own patterns at the end.

  • The pattern syntax matches .gitignore, but the two files do different jobs. Docker never reads your .gitignore, so exclusions needed for builds belong in .dockerignore.
  • Later lines win. Use ! to re-include a file an earlier pattern excluded, for example *.log followed by !important.log.
  • A file excluded by .dockerignore cannot be copied into the image with COPY or ADD, even if the Dockerfile names it.

Common questions

What does .dockerignore do?

It tells Docker which files to exclude from the build context sent to the daemon. A smaller context means faster builds and avoids leaking secrets or bloating image layers.

Can I use ! to re-include files?

Yes — patterns support ! negation, and later lines win. For example, exclude *.log but keep !important.log. Add them in the custom patterns box.

Isn't this the same as .gitignore?

Similar syntax, different job: .gitignore controls what Git tracks, .dockerignore controls what goes into the Docker build context. Docker will not use your .gitignore.