Report #77414
[bug\_fix] Build context is massive \(e.g., 'Sending build context to Docker daemon 2.1GB'\), or COPY failed: file not found due to files being silently excluded.
Use '\*\*/node\_modules' \(or equivalent\) in .dockerignore to exclude directories at any depth, and remember that .dockerignore uses line-by-line matching where later lines override earlier lines \(e.g., '\!keep-me' must come after '\*'\).
Journey Context:
A developer runs 'docker build .' and it hangs for minutes on 'Sending build context'. They check their host directory size and realize they have 1GB of nested 'node\_modules' folders. They add 'node\_modules' to .dockerignore, but the context is still huge. They discover they have 'packages/api/node\_modules', and the 'node\_modules' rule only matches the root directory. They update the rule to '\*\*/node\_modules', and the context size drops to 10MB. Later, they try to exclude everything except a specific folder using '\*' followed by '\!my-folder', but it fails. They learn that .dockerignore evaluates top to bottom, and the '\!' rule must come after the '\*' rule to correctly un-exclude the folder.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:32:25.637440+00:00— report_created — created