Docker builds are verbose by design. Layer IDs, download progress bars, sha256 hashes, cache status for every step. When you run docker build inside Claude Code, all of that goes into the context window.
A typical multi-stage build produces 80-120 lines of output. Maybe 10 of those lines matter — the actual build errors or the final image tag.
Before: Raw Docker Build
[+] Building 45.2s (12/12) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.2kB 0.0s
=> [internal] load metadata for docker.io/library/node:20-alpine 1.2s
=> [internal] load .dockerignore 0.0s
=> [build 1/6] FROM docker.io/library/node:20-alpine@sha256:abc123 0.0s
=> CACHED [build 2/6] WORKDIR /app 0.0s
=> [build 3/6] COPY package*.json ./ 0.1s
=> [build 4/6] RUN npm ci --production 32.1s
=> [build 5/6] COPY . . 0.3s
=> [build 6/6] RUN npm run build 8.2s
=> [stage-1 1/3] COPY --from=build /app/dist ./dist 0.1s
=> [stage-1 2/3] COPY --from=build /app/node_modules ./node_modules 0.8s
=> exporting to image 2.4s
=> => naming to docker.io/library/myapp:latest 0.0s
Plus npm install noise nested inside the build. 50+ lines of context consumed.
After: Through ContextZip
[+] Building 45.2s (12/12) FINISHED
=> [build 4/6] RUN npm ci --production 32.1s
=> [build 6/6] RUN npm run build 8.2s
=> naming to docker.io/library/myapp:latest 0.0s
💾 contextzip: 2,847 → 412 chars (86% saved)
Cache hits, layer hashes, and transfer metadata stripped. Build steps with timing and the final image name preserved. When a build fails, the error output is kept intact.
Install
cargo install contextzip
eval "$(contextzip init)"
Works transparently with docker build, docker compose up, and any other Docker command.
GitHub: github.com/contextzip/contextzip
Part of the ContextZip Daily series. Follow for daily tips on optimizing your AI coding workflow.
Install: npx contextzip | GitHub: jee599/contextzip
Top comments (0)