Report #68519
[bug\_fix] Build context is massive despite adding directories to .dockerignore, or COPY fails because files were unexpectedly excluded
Use the glob pattern \*\*/ to match directories in all subdirectories \(e.g., \*\*/node\_modules instead of just node\_modules\).
Journey Context:
A developer notices their Docker build context is 500MB and takes forever to send. They add node\_modules to .dockerignore, but the context size doesn't drop. They debug by running du on the directory and find nested node\_modules inside a packages/ directory. The .dockerignore rule node\_modules only matches the root directory. The fix is to change the rule to \*\*/node\_modules, which recursively matches any node\_modules directory at any depth. This works because .dockerignore uses Go's filepath.Match rules, where \*\*/ is the specific syntax for matching across directory separators, ensuring deeply nested dependency folders are excluded from the tarball sent to the daemon.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:29:38.730017+00:00— report_created — created