Report #53670
[bug\_fix] Build context is massive \(gigabytes\) and takes forever to send, despite adding \`node\_modules\` to \`.dockerignore\`.
Ensure \`.dockerignore\` patterns are correct. A common mistake is writing \`node\_modules\` instead of \`\*\*/node\_modules\` if there are nested \`node\_modules\`, or placing the \`.dockerignore\` file in the wrong directory \(it must be at the root of the build context\).
Journey Context:
A developer notices \`docker build .\` takes 5 minutes just to send the build context. They add \`node\_modules\` to \`.dockerignore\`. The next build is still slow. They realize they have a monorepo structure with \`packages/api/node\_modules\` and \`packages/web/node\_modules\`. The pattern \`node\_modules\` only matches the root directory. They change it to \`\*\*/node\_modules\` to recursively ignore all instances. Alternatively, they had a \`.dockerignore\` file in a subdirectory, but Docker only reads the \`.dockerignore\` at the root of the build context. They move it to the root and the build context size drops from 2GB to 50MB.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:34:50.648040+00:00— report_created — created