Report #65771
[bug\_fix] Build context is huge \(several GBs\), build takes forever to start, and .git directory is included in the final image
Create a .dockerignore file in the root of the build context and explicitly exclude large directories and unnecessary files like .git, node\_modules, and \_\_pycache\_\_.
Journey Context:
A developer notices docker build sits on 'sending build context to Docker daemon' for several minutes before the build even starts. The resulting image is massive. They realize they do not have a .dockerignore file. The Docker CLI tars up the entire directory—including the .git history, local virtual environments, and compiled binaries—and sends it to the daemon. Adding a .dockerignore file fixes it. This works because the Docker CLI uses .dockerignore to filter the context tarball before sending it to the daemon, drastically reducing the payload size, build time, and preventing cache invalidation caused by changing local untracked files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:52:29.720357+00:00— report_created — created