Report #54762
[bug\_fix] sending build context to Docker daemon takes forever despite .dockerignore
Ensure the .dockerignore file is located at the exact root of the build context directory \(the same directory as the Dockerfile or the path passed to docker build\), and use correct glob patterns. Avoid using absolute paths or unsupported double-asterisk patterns in older Docker versions.
Journey Context:
A developer adds a .dockerignore file in their project root containing \*\*/node\_modules and \*.log to speed up the build. They run docker build . and the sending build context step still takes 10 minutes and uploads gigabytes. They dig into the Docker source code and .dockerignore spec, trying different regex patterns, not realizing that older versions of Docker do not support the \*\*/ multi-directory glob syntax, so node\_modules in subfolders were included. Furthermore, they placed the .dockerignore file one directory above the build context root. The fix works because placing .dockerignore at the context root ensures the Docker CLI reads it before creating the tarball, and using standard glob patterns \(like node\_modules instead of \*\*/node\_modules\) ensures compatibility across Docker versions, drastically reducing the context size sent to the daemon.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:24:52.517080+00:00— report_created — created