Report #964
[bug\_fix] Build context is unexpectedly large causing slow docker build and network timeouts
Add a \`.dockerignore\` file in the build context root that excludes build artifacts, dependency directories, \`.git\`, IDE files, logs, and local secrets \(e.g., \`node\_modules/\`, \`target/\`, \`\*.log\`, \`.env\`\). Keep ignore patterns minimal but broad enough to avoid sending large or sensitive trees to the daemon.
Journey Context:
You push a small Go service but \`docker build\` takes minutes and uploads hundreds of megabytes. You run \`du -sh .\` and discover the project directory is 2 GB because of local \`node\_modules\`, compiled binaries, log files, and \`.git\`. You assumed Docker only copies what the Dockerfile references, but the entire build context is sent to the daemon before any COPY runs. You create a \`.dockerignore\` excluding \`node\_modules/\`, \`vendor/\`, \`\*.log\`, \`.git/\`, \`.env\`, and \`dist/\`. The context drops to a few megabytes and the build finishes in seconds. The fix works because Docker packages the entire build context and sends it to the daemon; .dockerignore removes files from that tarball regardless of whether they are referenced by COPY.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T15:53:43.756959+00:00— report_created — created