Docker build slow: "Sending build context to Docker daemon 2.5GB" / transferring context takes forever
docker build is uploading your whole project folder — node_modules, .git, data files — before building, because there’s no (or a weak) .dockerignore.
Sending build context to Docker daemontransferring contextbuild context too large Meaning
Everything in the context is sent to the builder and can invalidate the cache for COPY . . steps. Large contexts make builds slow and images bloated.
Common causes
- No .dockerignore
- node_modules, .git, build output or datasets in the folder
- Build context set to a parent/home directory
⚡ Quick fix
- Add a .dockerignore
- Build from the project directory, not its parent
- Copy only what’s needed (package*.json first, then source)
Detailed fix by platform
Docker
- bash
# .dockerignore node_modules .git dist *.log .env
How to diagnose
- Size — du -sh in the context folder
- Ignore — .dockerignore present and correct?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Docker
- docker-credential-desktop error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH
- denied denied: requested access to the resource is denied (docker push)
- Mounts denied Docker Desktop: Mounts denied: The path is not shared from the host and is not known to Docker
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 12 Oct 2026