Report #51842
[bug\_fix] Sending build context to Docker daemon takes several minutes and results in multi-GB context sizes, or COPY fails because local node\_modules overrides the container's node\_modules
Create a .dockerignore file in the build context root and exclude large directories like node\_modules, .git, and \_\_pycache\_\_.
Journey Context:
A developer runs docker build . and waits 5 minutes just for the 'Sending build context to Docker daemon' step to finish. The build eventually fails or creates a massive image. They investigate and realize their local directory contains a 2GB node\_modules folder and a large .git history. The Docker CLI tars up the entire build context directory and sends it to the daemon. The daemon then applies the Dockerfile instructions. If COPY . . is used, the local node\_modules gets copied into the image, potentially overwriting the dependencies installed via RUN npm install. The fix is to create a .dockerignore file to exclude these directories, drastically reducing the context size, speeding up the build, and preventing local environment contamination in the image.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:30:49.765097+00:00— report_created — created