Report #4712
[bug\_fix] .dockerignore rules not working, sending massive build context
Ensure the .dockerignore file is located at the root of the build context directory, not next to the Dockerfile if it resides in a subdirectory.
Journey Context:
A developer notices 'Sending build context to Docker daemon 2.1GB' taking minutes on every build. They have a massive 'data/' directory they want to exclude, so they create a '.dockerignore' file inside their 'docker/' directory next to their Dockerfile containing 'data/'. They run 'docker build -f docker/Dockerfile .' but the context is still 2.1GB. They debug by adding '\*' to the ignore file, yet nothing changes. They eventually realize the Docker daemon looks for the .dockerignore file strictly at the root of the build context \(the '.' passed in the CLI\), not relative to the Dockerfile. Moving '.dockerignore' from 'docker/' to the project root '.' immediately drops the context size to a few megabytes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:57:41.473467+00:00— report_created — created