1. Your build context
Reads only names and sizes, plus the .dockerignore and Dockerfile at the top, if there are any. Nothing is uploaded. Or paste the lists below.
From find . -type f or git ls-files. For sizes, use find . -type f -printf '%s %p\n'. End a line with / for an empty folder.
Report
Findings
Every path
| Path | Sent? | Decided by |
|---|
Why is one path left out?
The steps BuildKit takes, folder by folder, with the .dockerignore above.
How BuildKit reads a .dockerignore
- Patterns start at the context root.
*.logmatchesapp.log, notlogs/app.log. Use**/for any depth. This is the biggest difference from.gitignore. - The last matching line wins, and a line starting with
!is an exception. A folder's answer carries down to everything inside it. - An exception for a folder reaches inside only if the folder was excluded first.
**/*.mdthen!docskeeps every Markdown file indocs/out. Write!docs/**. - Excluded folders are skipped unless an exception line could match something inside them.
- Go's pattern syntax, through a regular expression:
[^a]negates (not[!a]), a negated class can match/, and\escapes the next character. A malformed line stops every build. - Comments only in the first column. Leading and trailing spaces are trimmed,
/at the start is dropped, anda/../bis cleaned tob.
Guide with worked examples: why a .dockerignore pattern does not match in subfolders.
From a terminal
The same engine runs over a real context folder, with no install and no network. It reads the folder, .dockerignore (or <Dockerfile>.dockerignore, as BuildKit does) and the Dockerfile.
node ventures/dockerignore-explainer/cli/check.mjs . # report node ventures/dockerignore-explainer/cli/check.mjs . --why src/a.js # the steps for one path node ventures/dockerignore-explainer/cli/check.mjs . --fixed # print the checked fix node ventures/dockerignore-explainer/cli/check.mjs . --strict # exit 1 on a high finding (CI)
Clone the source, then pass your context folder. Node 18 or later.
Questions
Why does *.log in .dockerignore not exclude logs in subfolders?
Because .dockerignore patterns are matched from the root of the build context, not at any depth like .gitignore. *.log matches app.log but not logs/app.log. Write **/*.log to match at every depth, and **/node_modules for node_modules folders inside packages.
Why does COPY fail with not found when the file exists?
Usually because a .dockerignore line excludes it. BuildKit sends only the files your rules let through, and COPY can only read what was sent, so an excluded source fails with a not-found error. Paste your Dockerfile with the .dockerignore and file list and the tool names the line that excludes each COPY source.
Why does !docs not re-include the files in docs?
BuildKit carries an exception for a folder down to the folder's contents only when the folder itself was excluded first. With **/*.md followed by !docs, the folder docs was never excluded, the Markdown files inside were matched directly, and !docs never reaches them. Write !docs/** instead.
Is [!a] a negated character class in .dockerignore?
No. Docker uses Go's pattern rules, where a class is negated with ^, as in [^a]. [!a] matches the character ! or a. And because the pattern becomes a regular expression, a negated class like [^a] can also match a slash.
Can I put a comment in .dockerignore?
Only on its own line, starting in the first column. A # after a pattern becomes part of the pattern, and a # line with spaces in front of it is trimmed and read as a pattern, not a comment.
Does excluding the Dockerfile or .dockerignore break the build?
Not with BuildKit, the default builder since Docker Engine 23. The Dockerfile is read separately from the context, so excluding it only keeps it out of what COPY . . copies into the image.
Is anything I paste or pick uploaded?
No. The checker runs entirely in this browser tab. Picking a folder reads only file names, sizes and the .dockerignore and Dockerfile at its top; no file content leaves your device, and the command-line version makes no network calls.