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.
Seen on:
Docker
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
Other ways to find it
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026