See how much the build context shrinks
docker build sends the files in the context to the builder before anything else runs. Enter the size of each path and your exclude patterns, and the tool reports which paths drop out, how many MB the context becomes, and the reduction as a percentage, along with a ready-to-paste .dockerignore. Each path is decided by the last line that matches its most specific form.
Copying a .gitignore straight over does not work. .dockerignore follows Go filepath.Match rules and always reads patterns from the context root, so reaching nested paths needs an explicit double star, and there is no directory-only form. The comparison table below lists the differences, following the Docker documentation checked in October 2026.
Sizes are a plain sum of what you type. Transfer compression, cache reuse and symbolic links are not modelled, so the real transfer can differ. The presets are a widespread convention rather than a specification, so check that nothing the build needs was excluded.
Frequently Asked Questions
Not recommended, because the syntax differs. .dockerignore always reads patterns from the context root and has no directory-only form, so a pattern that caught every depth in git may catch only the top level here.
Usually a file that COPY or ADD needs was excluded too. Look for paths whose state turned to excluded, and add an exception line starting with an exclamation mark below the rule that excluded it. The last matching line decides.
No. It is a sum of the MB values you typed and ignores compression, cache reuse and symbolic links. Use it to judge the share you are cutting, and read the build log for the exact number.