Sending build context 🐳 Docker

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

  1. Add a .dockerignore
  2. Build from the project directory, not its parent
  3. Copy only what’s needed (package*.json first, then source)

Detailed fix by platform

Docker

  1. bash
    # .dockerignore
    node_modules
    .git
    dist
    *.log
    .env

How to diagnose

  1. Size — du -sh in the context folder
  2. 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:

🧠 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.