Report #102945
[bug\_fix] docker build context transfer is extremely slow or fails with no space left on device because .git, node\_modules, target/, and build artifacts are sent
Create a \`.dockerignore\` in the build-context root that excludes directories not needed by the build: \`.git\`, \`node\_modules\`, \`target\`, \`.venv\`, \`\_\_pycache\_\_\`, \`\*.log\`, and local build output. Keep only files referenced by COPY or ADD. This reduces context size, speeds up transfers \(especially to remote builders\), and lowers the chance of unnecessary cache invalidation.
Journey Context:
Pushing a build to a remote BuildKit builder took several minutes and eventually failed with a disk-space error. I checked the image layers and they were small, so the bloat had to be in the build context. Listing the context showed \`.git\`, \`node\_modules\`, and several GB of local build artifacts being uploaded every time. Adding a focused \`.dockerignore\` reduced the context from gigabytes to a few megabytes, and builds completed in seconds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-10T04:45:34.193039+00:00— report_created — created